This project analyzes trending YouTube videos and user comments using the YouTube Data API. It performs sentiment analysis, extracts insights on viewer engagement, and visualizes results through an interactive Streamlit dashboard.
- 🔄 Fetch trending YouTube videos and metadata
- 💬 Collect and analyze user comments
- 🧠 Perform sentiment analysis using VADER and TextBlob
- 📈 Trend analysis of channels and videos
- 🌐 Region-wise filtering and visualization
- 📊 Interactive dashboard built with Streamlit
- Languages & Tools: Python, SQL, Streamlit
- Libraries: Pandas, Matplotlib, SQLAlchemy, TextBlob, VADER Sentiment
- API: YouTube Data API (v3)
- Database: PostgreSQL
.
├── analyze_trends.py # Analyzes top comments and channels
├── dashboard.py # Streamlit dashboard
├── sentiment_analysis.py # VADER-based sentiment scoring
├── trending-videos.py # Pulls trending videos from YouTube API
├── video-comments.py # Fetches video comments & applies sentiment (TextBlob)
├── youtube-channels.py # Fetches channel info
├── requirements.txt # Python dependencies
git clone https://github.com/aida-solat/youtube-data-analysis.git
cd youtube-data-analysispython -m venv venv
source venv/bin/activate # on Windows: venv\Scripts\activate
pip install -r requirements.txtMake sure PostgreSQL is installed and running. Then:
- Create a database named
youtube-data-analysis - Update credentials if needed in the
.pyfiles
- Go to Google Developers Console
- Enable YouTube Data API v3
- Generate an API key and replace
API_KEYin the scripts
python trending-videos.py
python video-comments.pypython sentiment_analysis.pypython analyze_trends.pystreamlit run dashboard.pyThe dashboard allows you to:
- Select a region (e.g., US, IN, GB)
- View top comments by likes
- Generate word clouds
- Explore sentiment distributions
Pull requests are welcome! For major changes, please open an issue first to discuss what you would like to change.