Skip to content

Instantly share code, notes, and snippets.

@danburzo
Created July 18, 2018 12:42
Show Gist options
  • Save danburzo/fef3471660447de95177e66722fec088 to your computer and use it in GitHub Desktop.
Save danburzo/fef3471660447de95177e66722fec088 to your computer and use it in GitHub Desktop.
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