Spaces:
Sleeping
Sleeping
| 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](https://developers.google.com/youtube/v3). | |
| - Optional: create a `.env` file with `YOUTUBE_API_KEY` to avoid typing the key every run. | |
| ## Installation | |
| ```bash | |
| 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 to `127.0.0.1`). | |
| - `PORT`: port for the Gradio server (defaults to `7860`). | |
| - `SHARE`: set to `true` to enable Gradio sharing links. | |
| - `YTD_LOG_LEVEL`: logging level (`INFO` by 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 | |
| ```bash | |
| 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_CHANNEL` in `config.py` if needed. | |
| - Monetization detection uses heuristics; adjust thresholds in `MonetizationThresholds` as 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! 🎉 |