Last active
May 4, 2016 21:35
-
-
Save hubgit/8227056 to your computer and use it in GitHub Desktop.
1. Sign in to http://movies.netflix.com
2. Open Chrome's Developer Console
3. Paste in the code below and press enter
This file contains hidden or 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
document.removeChild(document.documentElement); | |
var table = document.appendChild(document.createElement('table')); | |
var showData = function(i, title, movies) { | |
var tr = table.appendChild(document.createElement('tr')); | |
tr.scrollIntoView(); | |
var th = tr.appendChild(document.createElement('th')); | |
th.textContent = i; | |
var td = tr.appendChild(document.createElement('td')); | |
td.textContent = title.textContent.trim(); | |
var td = tr.appendChild(document.createElement('td')); | |
td.textContent = movies.length; | |
} | |
var fetchAltGenre = function(i, tries) { | |
var xhr = new XMLHttpRequest; | |
xhr.onload = function() { | |
var title = this.responseXML.querySelector('#page-title a'); | |
var movies = this.responseXML.querySelectorAll('.agMovie'); | |
if (title) { | |
showData(i, title, movies); | |
if (i < 100000) { | |
fetchAltGenre(++i, 1); | |
} | |
} else if (tries < 5) { | |
fetchAltGenre(i, ++tries); | |
} | |
}; | |
xhr.open('GET', 'http://movies.netflix.com/WiAltGenre?agid=' + i, true); | |
xhr.responseType = 'document'; | |
xhr.send(); | |
}; | |
fetchAltGenre(1, 1); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment