Skip to content

Instantly share code, notes, and snippets.

@amitkrxyz
Last active February 22, 2024 15:03
Show Gist options
  • Save amitkrxyz/ebd202becdc8d33bd10aff480d665adf to your computer and use it in GitHub Desktop.
Save amitkrxyz/ebd202becdc8d33bd10aff480d665adf to your computer and use it in GitHub Desktop.
Export YouTube subscriptions from your browser console

Steps

  1. Go to https://www.youtube.com/feed/channels while logged into your Google account.
  2. Scroll to the bottom to ensure all subscriptions are fully loaded on the page.
  3. Press Ctrl + Shift + j to open the developer console.
  4. Copy and paste the provided script.js code.
  5. Right click on the generated text and select Copy string contents.
  6. Paste the copied text into a new file, preferably ending with .json, for example, my-subscriptions.json.
const channelsElement = document.querySelectorAll('#main-link')
const channels = Array.from(channelsElement)
.map(c => {
//const name = c.querySelector("#text").textContent
//const handle = c.querySelector('#subscribers').textContent
const url = c.href
return url
}
)
JSON.stringify(channels, null, 2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment