Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Grab a JSON of your YouTube favorite videos (or any other playlist)
/*
Get your Youtube favorite videos
--------------------------------
1. Navigate to your Favorites page
2. Scroll the list all the way down such that all videos are loaded into the browser.
3. Copy the JavaScript code below and run it in your console; a JSON of your videos
will be loaded into your clipboard.
4. Paste into a file on your computer.
(Valid in July 2018)
*/
copy(
JSON.stringify(
[].slice.call(
document.querySelectorAll("ytd-playlist-video-renderer")
).map(el => {
let data = el.__data__.data;
return {
thumbnail: `https://i.ytimg.com/vi/${data.videoId}/hqdefault.jpg`,
id: data.videoId,
title: data.title.simpleText,
by: data.shortBylineText ? data.shortBylineText.runs.text : null,
duration: data.lengthSeconds
}
}).reverse(),
null,
2
)
);
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.