This is a Python script that will take a text file with your cover tunes set list and create a YouTube playlist containing videos for all the songs in the list. Perfect for the music director of a working cover band to create playlists to break in new tunes or new players.
When run, the script reads in the text file. Since it uses youtube's search function it doesn't need to be a specific format. Each line can be as simple as the song name and the band that does it. If there is a specific version you'd like to include, just put in the title as it shows on youtube (e.g. Long version, or metal version). For each line in the list, it searches YouTube for a video of each song and adds the first result to a playlist with the title you specified.
This program is built from Adam Goforth's Billboard Top N Playlist creator. Finding his work allowed me to get this working within an hour. GPL FTW!
Also note that while this works it is super crufty right now. I'm not sure if the pipenv bits work at all. There is next to zero argument checking. Running it like this works:
python3 createsetplaylist.py -l setlist -t "Test Set Play List"
An example of what the script creates can be seen here:
https://www.youtube.com/playlist?list=PL3YYv-ltyAmMX-H2CwI9h4awPRAauJ2PI
This script depends on Python 3.4 and these Python packages:
-
Clone the git repository.
-
Install the Python dependencies with pipenv. Run this command within the root directory of the repository:
$ pipenv install
-
Create a new project in the Google Developer Console by clicking the "Select a project" dropdown in the header and clicking the "Create a project" button. Give the project any name you like. After creating the project, open it if it isn't opened automatically.
-
Enable the Youtube Data API in the Library tab of your Google Developer Console. Open the "Library" tab, then click the "Youtube Data API" link and click the "Enable" link.
-
Create an API key. Go to the Credentials tab in the Google Developer Console and click "Create credentials". Select "API key" from the dropdown.
-
Create a new client ID. Still on the Credentials tab of the Google Developer console, click "Create credentials". Select "OAuth client ID" from the list and select the application type "Other". Click the "Create" button. Click "OK" in the modal dialog that appears. The new client ID should appear on the Credentials page. Click the "Download JSON" button for your new client ID. A download of the JSON key will start in your browser. Save the file with the name
client_secrets.json
in the root directory of your clone of the git repository. -
Copy
settings-example.cfg
tosettings.cfg
and fill in the API key you created in step #5. Then run:$ pipenv run python createsetplaylist.py --noauth_local_webserver
-
The first time you run the script, you will have to authenticate the application in a web browser. Open the URL that the script outputs, approve the application for the YouTube Account in which you want to create the playlists, and enter the verification code on the command line. This will create a file,
oauth2.json
, which must be kept in the root of the git repository as long as you want to upload playlists to this account. -
In subsequent runs of the script, you can run it without any command line arguments:
$ pipenv run python createsetplaylist.py
If the script was working, but you start getting HttpError 404 responses with
the message "Channel not found.", you may have to re-authorize the application.
Do this by deleting the oauth2.json
file and running the script
with --noauth_local_webserver
.
This code is free software licensed under the GPL 3. See the LICENSE.md file for details.