Skip to content

Instantly share code, notes, and snippets.

@jffry
Created September 16, 2015 22:14
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/d4a52c3997e4e3061683 to your computer and use it in GitHub Desktop.
Save jffry/d4a52c3997e4e3061683 to your computer and use it in GitHub Desktop.
Finding the ng-conf easter egg

ng-conf tweeted that they had some easter eggs. YouTube annotations seemed like a good place to hide one, so I scraped the annotations from their videos.

First, can we programmatically get annotations? Yes! Googling around reveals URLs like https://www.youtube.com/annotations_invideo?features=1&legacy=1&video_id=QHulaj5ZxbI

Second, how to get a list of all their video IDs? Quick and dirty! I opened their channel's video list at https://www.youtube.com/user/ngconfvideos/videos and used my browser console to scrape out the video IDs:

//open browser devtools on https://www.youtube.com/user/ngconfvideos/videos
var ids = Array.prototype.slice.call(document.querySelectorAll('a[href]'))
  .map(function(a){ var m = /watch\?v=([^&]+)/i.exec(a.href); if (m) return m[1]})
  .filter(function(id){ return id; });
console.log(ids.join('\n'));
/* =>
Re7jY4pRY_Y
Re7jY4pRY_Y
yh4ExTTrScQ
yh4ExTTrScQ
z0-dkOavwsg
z0-dkOavwsg
XQM0K6YG18s
XQM0K6YG18s
jzkQXlvpvHU
jzkQXlvpvHU
...
*/

Third, to search. We'll use curl to download all these annotations, and grep to look at the output. Paste the output from the dev console into a text editor, sort unique, and then bodge into something like this and run it in your shell:

curl \
"https://www.youtube.com/annotations_invideo?features=1&legacy=1&video_id=Re7jY4pRY_Y" \
"https://www.youtube.com/annotations_invideo?features=1&legacy=1&video_id=yh4ExTTrScQ" \
"https://www.youtube.com/annotations_invideo?features=1&legacy=1&video_id=z0-dkOavwsg" \
"https://www.youtube.com/annotations_invideo?features=1&legacy=1&video_id=XQM0K6YG18s" \
"https://www.youtube.com/annotations_invideo?features=1&legacy=1&video_id=jzkQXlvpvHU" \
| grep ti.to

...and out pops the registration link!

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