Skip to content

Instantly share code, notes, and snippets.

@aaronjorbin
Created October 20, 2012 20:35
Show Gist options
  • Save aaronjorbin/3924712 to your computer and use it in GitHub Desktop.
Save aaronjorbin/3924712 to your computer and use it in GitHub Desktop.
Get a list of all twitter handles at WordCamp Philly 2012
// Get Twitter accounts on the WC Philly 2012 site
var page = require('webpage').create(),
system = require('system');
// Route "console.log()" calls from within the Page context to the main Phantom context (i.e. current "this")
page.onConsoleMessage = function(msg) {
console.log(msg);
};
// Open the page, onPageLoad, do...
page.open(encodeURI("http://2012.philly.wordcamp.org/about/attendees/" ), function (status) {
// Check for page load success
if (status !== "success") {
console.log("Unable to access network");
} else {
// Execute some DOM inspection within the page context
page.evaluate(function() {
var list = document.querySelectorAll('a.tix-attendee-twitter');
for (var i = 0; i < list.length; ++i) {
console.log( list[i].innerText );
}
});
}
phantom.exit();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment