Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Dump YouTube playlist data from console to JSON
var dump = Array.from(document.querySelectorAll('ytd-playlist-video-list-renderer ytd-playlist-video-renderer')).map(item => {
return {
id: item.querySelector('a').href.match(/v=([^&]+)&/)[1],
title: item.querySelector('h3 span').textContent.trim(),
thumb: item.querySelector('ytd-thumbnail img').src,
by: item.querySelector('ytd-channel-name').textContent.trim() || null
};
});
var url = URL.createObjectURL(new Blob([JSON.stringify(dump)], { type: "application/json" }));
window.open(url);
console.log("Dumped", dump.length, "videos");
console.log(dump);
console.log(url);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.