Last active
January 19, 2017 19:50
-
-
Save sQu1rr/e4bd52855acb880060bf3d7ba31e3561 to your computer and use it in GitHub Desktop.
after injecting jquery into youtube history page, run this script (on youtube history page) to populate ${objects} array with your video history dating back 5 years
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var stop = false; | |
var url = $('.browse-items-load-more-button').attr('data-uix-load-more-href'); | |
var objects = []; | |
function gett() { | |
$.getJSON(url, function (res) { | |
console.log(url); | |
var content = res.content_html.match(/class="yt-lockup-content".*?class="yt-lockup-meta-info"/g); | |
content.forEach(function (row) { | |
var link = row.match(/href="([^"]*)"/); | |
var title = row.match(/\<a.*?\>(.*?)<\/a>/); | |
row = row.replace(/^.*?\<\/h3\>/, ''); | |
var userLink = row.match(/href="([^"]*)"/); | |
var userTitle = row.match(/\<a.*?\>(.*?)<\/a>/); | |
var object = { | |
url: link[1], | |
title: title[1], | |
userUrl: userLink[1], | |
user: userTitle[1] | |
}; | |
objects.push(object); | |
}); | |
var next = res.load_more_widget_html.match(/data-uix-load-more-href="([^"]*)/); | |
if (next && !stop) url = next[1]; | |
else url = null; | |
if (url) gett(); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment