A YouTube Music recommender system that creates personalized playlists based on your previous and current tastes.
Originally built for Spotify, it was switched to YouTube Music after recent API changes limited free developer access.
uv pip install -e .
- Go to YouTube Music and log in.
- Use the
ytmusicapi setupcommand to generate your.headers_auth.jsonfile:
ytmusicapi setup- Save the generated
.headers_auth.jsonin the root of your project. - This file contains your browser authentication headers and allows the app to access your playlists and library.
- Save all .env credentials in GitHub secrets.
- Setup the repo first in your local env.
Default workflow in this repo will run everyday at midnight and create a new playlist.
There are a few global variables in main.py that are relevant for playlist creation:
For User top tracks:
USER_RECENT: Number of recently played tracks and top user recent tracks that are to be considered in recommendation.USER_GLOBAL: Number of long term played tracks for user that are to be considered in recommendation.
For recommended artists:
ARTIST_SIMILAR: Number of similar artists to search for each of the top user top tracks.ARTIST_SIMILAR_RECS: Number of records to search for each similar artist found.
For playlist creation:
SIM_THRESHOLD: Similarity threshold lowerbound, ranges from0.0to1.0.MAX_NEW: Maximum number of tracks to add in playlist which are above theSIM_THRESHOLD.
uv run python main.py