Skip to content

Instantly share code, notes, and snippets.

@alirobe
Created October 18, 2025 00:19
Show Gist options
  • Save alirobe/4093d7b11b84de9771c1874e6fb5bea6 to your computer and use it in GitHub Desktop.
Save alirobe/4093d7b11b84de9771c1874e6fb5bea6 to your computer and use it in GitHub Desktop.
Extract YouTube subscription channel metadata from channel page
// goto https://www.youtube.com/feed/channels
// set to a-z and scroll all the way down until loading ends
// run in terminal:
arr = Array.from(document.querySelectorAll('ytd-channel-renderer'))
data = []
arr.forEach((item, index) => {
data.push({
title: item.querySelector('.ytd-channel-name').innerText,
handle: item.querySelector('yt-formatted-string#subscribers').innerText,
subs: item.querySelector('#video-count').innerText,
description: item.querySelector('#description').innerText,
link: 'https://youtube.com' + item.querySelector('a#main-link').href
})
})
console.log(data)
// side-note: why are YouTube using IDs? I thought that was inefficient...
@alirobe
Copy link
Author

alirobe commented Oct 18, 2025

Google sheets AI prompt: =AI("Determine the high-level category for each YouTube channel based on its description, title, handle, and link. chosen from: STEM, Arts Philosophy and History, Social and Entertainment, Economics Business and Money, Medicine and Health, Technology and Innovation, Opinion News and Politics, Lifestyle & Life skills, Religion, Sports, Other",RANGE)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment