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.