Spaces:
Sleeping
Sleeping
A newer version of the Gradio SDK is available: 6.15.2
metadata
license: mit
title: YouTube Trends Analysis Dashboard
sdk: gradio
emoji: 💻
colorFrom: pink
colorTo: purple
thumbnail: >-
https://cdn-uploads.huggingface.co/production/uploads/6479c45bc42a44cf4c160d68/FPEmHIsLEHU1Dy94NbKds.jpeg
short_description: A Gradio-powered dashboard that uses the YouTube Data API v3
📺 YouTube Trends Analysis Dashboard
A Gradio-powered dashboard that uses the YouTube Data API v3 to surface recently created channels that already meet monetization thresholds. Analyse niches, content formats, engagement metrics, and trending keywords for fast-growing newcomers.
Features
- 🔎 Searches for channels created within the last 90 days (configurable) and enriches them with channel + recent video data.
- 💰 Applies heuristic monetization rules (subscribers, views, video volume) to focus on likely monetized channels.
- 📊 Generates overview metrics and tabular insights using pandas and NumPy.
- 📈 Builds interactive Plotly visualizations for growth trends, niche distributions, content types, and keyword popularity.
- ⚡️ Caches API responses in memory to avoid redundant calls during a session.
- 🧩 Gradio UI with API key input, optional region selector, and tabbed layout for core insights.
Prerequisites
- Python 3.10+
- A valid YouTube Data API v3 key.
- Optional: create a
.envfile withYOUTUBE_API_KEYto avoid typing the key every run.
Installation
python -m venv .venv
.\.venv\Scripts\activate
pip install -r requirements.txt
Configuration
Environment variables (all optional):
YOUTUBE_API_KEY: default API key used when the UI input is left blank.HOST: host for the Gradio server (defaults to127.0.0.1).PORT: port for the Gradio server (defaults to7860).SHARE: set totrueto enable Gradio sharing links.YTD_LOG_LEVEL: logging level (INFOby default).
Example .env file:
YOUTUBE_API_KEY=AIza...your key...
HOST=0.0.0.0
PORT=7860
SHARE=false
YTD_LOG_LEVEL=DEBUG
Running the Dashboard
python app.py
Open the displayed Gradio URL in your browser, supply your API key (or rely on the .env file), select an optional region, and click Fetch & Analyze.
Project Structure
app.py # CLI entry point and Gradio launcher
youtube_trends_dashboard/
config.py # Default settings and helper constants
exceptions.py # Custom exception hierarchy
youtube_api.py # API client for YouTube Data API v3
analysis.py # Data wrangling, heuristics, and summaries
pipeline.py # High-level orchestration and caching
ui.py # Gradio interface assembly
utils.py # Shared helpers
Notes
- API quota usage can be significant—limit
DEFAULT_MAX_CHANNELS/DEFAULT_MAX_VIDEOS_PER_CHANNELinconfig.pyif needed. - Monetization detection uses heuristics; adjust thresholds in
MonetizationThresholdsas required. - When analysis returns no results, the UI surfaces clear error messages to help refine the query.
Enjoy exploring the latest monetized trends on YouTube! 🎉