Exports youtube playlists to json or tsv.
Doesn't use yt-dlp as that can be unreliable when downloading private playlists
-
Go create a new project at: https://console.cloud.google.com/
-
Then under the
APIs and servicessection search forYouTube Data API v3and clickenable -
Next click onto the
Credentialstab and clickCreate credentialsthenCreate OAuth client ID -
After that click
Configure consent screenthenget started -
It will give you a form to fill out just make sure you select
Externalunder audience and you dont need to give a valid contact email -
Once you are done with the form click
Create -
Now you can create your credentials by clicking
Create OAuth client -
Select
Desktop appand thenCreate -
When it shows a pop up click
Download JSONand save it in the same directory as the script under the namecredentials.json -
Now you need to go back to the
Audiencetab and underTest usersclickAdd users -
Then add your email and click
Save -
Install dependencies:
python -m pip install -r requirements.txt -
After that extremely convuluted setup process you are ready to run the script:
python youtube_backup.py -v -
On your first run it will prompt you to sign into your google account (may open automatically)
-
It will say something like google hasn't verified this app, just click
continue -
Now go back to the terminal and complete the setup.
-
You also need to make sure you have created a channel for this script to work otherwise it will produce an error.
-
After you have completed your setup you are all complete.
-
Make script executable:
chmod +x youtube_backup.py -
Then run:
crontab -e -
And add this line with a correct file path:
0 0 * * * /path/to/youtube_backup.py --config /path/to/config.json --credentials /path/to/credentials --backup /path/to/Backup
Make sure you follow the setup completely but if you are still having an problem just raise an issue :-)