Viewers only, not for creators
Automatically gets subscribed channels, personal playlists and saved playlists from the old account.
Ensures the new account:
- subscribes to all the channels with confirmation prompts
- has all personal playlists created with the same title and videos with confirmation prompts
- has all the saved playlists added (WebDriver Automation)
- Ruby
gem install google-api-client
or see Quickstart guide
- YouTube credentials created and saved to
auth/
for an OAuth application named YouTube Data Migrationauth/old_account_client_secret.json
auth/new_account_client_secret.json
YouTube Data API v3
enabled on Google APIS Dashboard- (Optional) Python for saving playlist data and cookies – see below
- The new account has a Channel
Run ruby migrate.rb
and authenticate your old and new accounts. Confirm each step when prompted.
Alternatively run YES_TO_ALL=true ruby migrate.rb
to avoid being prompted.
There's no API for managing saved playlists, so we extract them from web traffic data and use web driver for adding them.
You can save the data yourself (using a browser and its developer console) or use a proxy server.
For automatically getting saved playlists data with mitmproxy
:
pip install mitmproxy
and trust the certs- In the project root, run
mitmproxy -s ./proxy/save-playlists.py
to start the proxy server - Configure proxy settings in your favourite browser for HTTPS traffic and set the server to
localhost:8080
- Navigate to your personal YouTube Saved Playlist page and keep scrolling until all playlists are displayed. The URL should be like something like
https://www.youtube.com/user/<username>/playlists?view=52&sort=dd&shelf_id=0
- Don't browse any other YouTube page. Quit
mitmproxy
as soon as possible to avoid saving incorrect data made by other AJAX requests. - Run
ruby extract-playlists.rb
. Thesaved-playlists.py
automatically saves your data indata/
forextract-playlists.rb
to process.
There are two ways:
- Go on a clicking frenzy. Mind your computer resources if you have lots of playlists!
- Run
grep ':id:' data/saved-playlists.yaml | awk '{ print $2 }' | xargs -I"{}" open "https://youtube.com/playlist?list={}"
(change theopen
command for your OS). - All playlists will be opened in your browser, you just have to click and
Command + w
until they're all saved.
- Run
- Use Selenium and friends
gem install watir
and grab the cookies from authenticated session for you new account withmitmproxy -s ./proxy/save-cookies.py
- I use Safari. Ensure
Develop > Allow Remote Automation
is enabled. - Feel free to use other browsers but you have to ensure the driver is available and usable – see Watir guides
- Or go headless
- Run
ruby add-saved-playlists.rb
orYES_TO_ALL=true ruby add-saved-playlists.rb
FYI: Selenium Webdriver has never been the most reliable thing in the world. Timed out? just rerun.
- Subscription list does not included suspended channels even if they are still shown on your sidebar
- Too lazy to use Bundler as we only use at most 2 Gems