Skip to content

Instantly share code, notes, and snippets.

@jffry
Created November 13, 2015 03:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jffry/5bbdd9afd243969594ae to your computer and use it in GitHub Desktop.
Save jffry/5bbdd9afd243969594ae to your computer and use it in GitHub Desktop.
LateShowBirthday

Background

Recently the Late Show programmatically generated Happy Birthday videos for over 1000 different names, and uploaded them all to YouTube (for example, "Happy Birthday jeff").

I wanted a nice easy-to-search list of all the videos, so I cobbled together a little javascript in my browser window to do the trick.

Extraction

Go to the list view of LateShowBirthday's videos

Open dev console and run this to get the whole list:

var to = setInterval(function(){
	document.body.scrollTop += 10000;
	document.querySelector('.load-more-button').click();
}, 100)
//later, when it's done
clearInterval(to);

When the list finishes loading and you've cleared the timeout, grab the list of video URLs and titles:

var elts = Array.prototype.slice.call(document.querySelectorAll('#content .feed-item-container a.spf-link'));
var data = elts.map((a) => { return { href: a.href, title: a.title }; });
var markdown = data.map((vid) => `* [${vid.title}](${vid.href})`).join('\n');
console.log(markdown);

Now bodge that into some Markdown!

The List

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