How praiseprince/spotifetch works
Project type and purpose
• This is a monolithic full-stack web application built with Python and Flask.
• Its purpose is to let users enter a Spotify link, retrieve track/playlist/album data via the Spotify Web API, fetch and convert the audio from YouTube using yt-dlp and ffmpeg, tag it with mutagen, and serve back MP3 or ZIP downloads.
File structure
• Top level:
• .env – holds Spotify credentials and temp path
• main.py – Flask app and HTTP route definitions
• SpotiFetch.py – core business logic (API calls, download, conversion, tagging)
• requirements.txt – Python dependencies
• templates/index.html – front-end form and result page
• static/style.css + PSD assets – styling and branding
• No database; uses file storage (TEMP_PATH) for intermediary and final files.
README for additional insights
• Confirms tech stack: Python, Flask, yt-dlp, ffmpeg, mutagen, HTML/CSS
• Describes the eight-step processing pipeline
• Outlines environment configuration and local run instructions
a. Main components
• Browser client (HTML/CSS form)
• Flask Web Server (main.py)
• Business Logic Module (SpotiFetch.py)
• Spotify Web API
• YouTube Download Service (yt-dlp)
• FFmpeg Converter
• Mutagen Metadata Tagger
• File Storage (temp folder and final download directory)
• Environment Config (.env)
b. Relationships and interactions
1. User submits a Spotify link via browser → HTTP POST to Flask
2. Flask route invokes SpotiFetch logic → reads .env for credentials and path
3. Logic calls Spotify API → receives JSON metadata
4. Logic transforms metadata into search terms → invokes yt-dlp to fetch audio from YouTube
5. yt-dlp returns raw audio → passed to ffmpeg for MP3 conversion
6. Converted MP3 sent to mutagen for tagging (cover art, artist, album, date)
7. Finished MP3 or ZIP archive stored in TEMP_PATH
8. Flask serves the file back to the user over HTTP
c. Architectural patterns and design principles
• Monolithic MVC style:
• View layer: templates + static assets
• Controller: Flask routes in main.py
• Model/Service: SpotiFetch.py
• External integration pattern: third-party APIs and CLI tools
• Configuration separation via environment variables
d. Key technologies and libraries
• Flask (web framework)
• requests or spotipy (Spotify API calls, if used)
• yt-dlp (YouTube downloader)
• ffmpeg (media conversion)
• mutagen (metadata tagging)
• HTML/CSS (frontend)