A high-performance React and Flask application that parses massive YouTube Music listening histories to generate immersive, shareable dashboards. Built with a Stale-While-Revalidate (SWR) cache in Supabase/Neon, multi-tier fallback metadata enrichment (Last.fm & JioSaavn), native-feeling swipeable 'Story Mode' transitions, and instant 9:16 exportable posters — protected by Firebase Auth and custom hash-routed sandboxing.
- Month Capsule: Total playtime, Top 5 Artists (by minutes), Top 5 Songs (by plays), Streak, Listening Split, and Throwback
- Song duration enrichment via YouTube Data API v3 (with graceful fallback)
- YouTube-native dark theme
cd backend
pip install -r requirements.txt
# Optional but recommended: set your YouTube Data API v3 key
# Without it, durations default to 3.5 min per track
export YT_API_KEY=your_key_here
python app.pyBackend runs on http://localhost:5000
Getting a YouTube Data API key:
- Go to console.cloud.google.com
- Create a project → Enable "YouTube Data API v3"
- Credentials → Create API Key
- Free quota: 10,000 units/day (each video duration fetch = 1 unit)
cd frontend
npm install
npm run devFrontend runs on http://localhost:5173
The Vite dev server proxies /api/* to Flask automatically.
- Go to myaccount.google.com → Data & Privacy → Download your data
- Select YouTube and YouTube Music only, format: JSON
- After download, find:
Takeout/YouTube and YouTube Music/history/watch-history.json - Upload it in the app
ytmusic-stats/
├── frontend/ # Vite + React
│ └── src/
│ ├── pages/ # UploadPage, DashboardPage
│ ├── components/ # Navbar, MonthCapsule
│ └── styles/ # global.css
└── backend/ # Flask
└── app.py # Parse → Enrich → Analytics → JSON
| Stat | Method |
|---|---|
| Total Playtime | Sum of song durations (seconds → minutes) |
| Top 5 Artists | Ranked by total minutes listened |
| Top 5 Songs | Ranked by play count (≥30s = 1 play) |
| The Streak | Longest consecutive days for top artist |
| Listening Split | Top artist's % of total time |
| The Throwback | Top-5 song from 3 months ago with biggest play drop |
- Without a YouTube API key, all durations fall back to 3.5 minutes per track. Playtime and artist rankings will still work, but won't be perfectly accurate.
- The backend caches fetched durations in memory — re-uploading the same file won't re-fetch durations.
- Only entries with
"header": "YouTube Music"are analyzed.