This script allows you to automatically add songs from a CSV file to a YouTube Music playlist.
- Python 3.7+
- Poetry for dependency management
-
Clone the Repository
git clone https://github.com/ChrisNourse/YouTube-Music-Playlist-Loader.git
-
Set up the Python environment with Poetry
poetry install
To use the ytmusicapi
, you'll need to authenticate via a oauth.json
file.
To generate oauth.json
, follow the instructions on the ytmusic documentation:
https://ytmusicapi.readthedocs.io/en/stable/setup/index.html
The CSV file should be formatted as follows:
Artist,Song
Queen,Bohemian Rhapsody
The Beatles,Let It Be
... and so on
Ensure there are no extra spaces or lines.
-
Prepare your
songs.csv
as described above. -
Run the script:
playlistLoader.py
-
If you haven't provided a playlist URL in the code, you will be prompted to enter it when you run the script.
-
The script will read songs from the CSV, search for them on YouTube Music, and add them to the specified playlist.
- If there's an artist mismatch, you'll be prompted to choose among the search results or skip the song.
- The script checks if a song is already in the playlist before attempting to add it.
- Ensure you handle the
oauth.json
with care, as it contains sensitive data.
This project utilized OpenAI's ChatGPT for assistance in generating portions of the code and documentation. Special thanks to the OpenAI team for their contributions to the AI community.