Imports subscriptions from an xml/rss feed file into a youtube account. This is useful for transferring youtube subscriptions from one youtube account to another.
-
Get the properly formatted xml file from the account you wish to transfer subscriptions from
- Go to Subscriptions
- Go to Manage Subscriptions
- Scroll to end of page
- Click Export Subscriptions next to Export to RSS readers
-
Get authenticated, since this requires access to your google account you must generate the correct
client_secrets.json
file- Create project in the Developer Console
- Next register for YouTube API, go to the project you just created and in the Developer Console.
- Go to the API Library and turn YouTube Data API to ON.
- Download JSON credentials, go to Credentials if not created already, create one must be OAuth 2.0. Select the created credential and click on Download JSON.
- Rename the downloaded JSON file to
client_secrets.json
and drag into this root directory, must be in the same folder assubscribe.py
.
-
Make sure all required packages are installed before running
To do this I recommend using a virtual environment.
$ virtualenv -p python3 env $ source env/bin/activate $ pip install -r requirements.txt
-
Run the script
To do this either drag the exported xml file from step 1 into this root directory and name it
subscriptions.xml
or run the script with this argument$ python3 subscribe.py --xml /path/to/xml/file.xml
There is a request cap every few hours, I believe the cap is around ~70 subscriptions per few hours. So you may have to run the script several times before being able to fully import everything. I have not yet figured out a way around this.