Last active
August 29, 2017 10:07
-
-
Save swapnilraj/51e65c471ae6ed660902908185a4fe3a to your computer and use it in GitHub Desktop.
Javascript snippet to get the name of subscriptions and channel links on Youtube.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(() => { | |
let subs = Array.from(document.querySelectorAll('#sections > ytd-guide-subscriptions-section-renderer > div#container > ytd-guide-entry-renderer')).map( | |
e => `${e.querySelector('span.title').innerText} - ${e.querySelector('a').href}`, | |
); | |
if (subs.length === 0) { | |
subs = Array.from(document.querySelectorAll('#guide-channels > li.guide-channel')).map( | |
e => `${e.querySelector('span.display-name').innerText} - ${e.querySelector('a').href}`, | |
); | |
} | |
const subList= JSON.stringify(subs, undefined, 2); | |
console.log(subList) | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment