A little Python tool I wrote to move my YouTube subscriptions from one Google account to another, without paying $15 for the privilege.
Google Takeout gives you your subscriptions as a raw subscriptions.csv. The Subscriptions Importer for YouTube Chrome extension can import them into another account, but the free version only takes 50 channels at a time. This script turns the CSV into batches of channel URLs and puts them on your clipboard, ready to paste into the extension, so you can work through a long list 50 at a time for free.
- Converts the Takeout CSV to JSON on the first run, then reuses it.
- Copies whatever range of channel URLs you ask for to your clipboard, one per line.
- Asks again if you type something that isn't a whole number.
- Tells you how many URLs it copied, and lets you know when you've hit the end of your list.
- Prints the URLs to the terminal instead if it can't find a clipboard on your system.
- Keeps your data out of git:
.gitignoreexcludes the CSV and JSON files, because I didn't want to accidentally push my own.
- Python 3, and a basic idea of how to open a terminal and run a script
- pyperclip (installed from
requirements.txt) - Google Chrome with the Subscriptions Importer extension, signed in to the account you're moving your subs to
git clone https://github.com/theruvial/subscriptionParser.git
cd subscriptionParser
pip install -r requirements.txt-
Go to takeout.google.com while signed in to the account you're moving your subs from.
-
Click Deselect all, then scroll down and tick YouTube and YouTube Music.
-
Click All YouTube data included, untick everything except subscriptions, and click OK.
-
Click Next step and pick how you want your files delivered. Google takes a few minutes to put the export together, so be patient 😊
-
Download the zip and extract it. It should look something like this:
-
Copy
Takeout/YouTube and YouTube Music/subscriptions/subscriptions.csvinto the repo folder.
python subscriptionParser.pyThe first run creates subscriptions.json next to the script. That's normal. It then asks for a start and an end number. Your list starts at 0, and the end number isn't included, so 0 and 50 gets you the first 50 channels.
- Click the extension in Chrome (usually under the puzzle piece in the top right).
- Paste the URLs into the box that says Paste Exported Channels List here.
- Scroll down, click Import, then Import again on the next page.
Then run the script again for the next batch: 50 to 100, 100 to 150, and so on. When it tells you it couldn't copy all 50, that was your last batch, and you're done. Congrats on beating the paywall!
- The import gets stuck. For some reason, YouTube keeps you subscribed to channels that have been banned, and the extension can hang on them. Keep an eye on it while it runs. If it stalls, close the tab it opened and click Unstuck Process.
- You're using a new export. The script reuses
subscriptions.jsonif it already exists, so delete it before running again with a newsubscriptions.csv. - Nothing ends up on your clipboard. On Linux, pyperclip needs
xclip,xselorwl-clipboardinstalled. Without one, the script prints the URLs to the terminal so you can copy them yourself.
MIT © 2023 Thea Arcadia
