Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Save YouTube subscriptions

Open https://www.youtube.com/feed/channels, open JS console.

Save as Markdown list

console.log(
  Array.from(document.querySelectorAll("ytd-channel-renderer"))
    .map((item) => ({
      title: item.querySelector("#text-container").textContent.trim(),
      url: item.querySelector("#main-link").href,
    }))
    .map(({ title, url }) => `- [${title}](${url})`)
    .join("\n")
);

Save as JSON array

console.log(
  JSON.stringify(
    Array.from(document.querySelectorAll("ytd-channel-renderer")).map(
      (item) => ({
        title: item.querySelector("#text-container").textContent.trim(),
        url: item.querySelector("#main-link").href,
      })
    ),
    null,
    2
  )
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment