Created
August 3, 2012 14:06
-
-
Save mariuz/3247959 to your computer and use it in GitHub Desktop.
make a full picture of carmack tweets
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 page = require('webpage').create(); | |
page.open('http://twitter.com/ID_AA_Carmack', function (status) { | |
if (status !== 'success') { | |
console.log('Unable to access network'); | |
} else { | |
var hitRockBottom = false; | |
while (!hitRockBottom) { | |
//scroll the page (not sure if this is the best way to do so...) | |
page.scrollPosition = { top: page.scrollPosition + 1000, left: 0 }; | |
// Check if we've hit the bottom | |
hitRockBottom = page.evaluate(function() { | |
return document.querySelector(".has-more-items") === null; | |
}); | |
} | |
page.render('output5.jpg') | |
var ua = page.evaluate(function () { | |
return document.getElementById('page-container').innerHTML; | |
}); | |
console.log(ua); | |
} | |
phantom.exit(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
scrolling not working.can't get any output.