Skip to content

Instantly share code, notes, and snippets.

@julianeon
Created February 2, 2014 02:27
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 julianeon/8762148 to your computer and use it in GitHub Desktop.
Save julianeon/8762148 to your computer and use it in GitHub Desktop.
To find NYTimes Dealbook summaries.
// Find summary of articles in NYTimes.
var page = require('webpage').create(),
url = 'http://dealbook.nytimes.com/category/main-topics/legal/';
page.open(url, function (status) {
if (status !== 'success') {
console.log('Unable to access network');
} else {
var results = page.evaluate(function() {
var list = document.querySelectorAll('h3.entry-title'), summary = [], i;
for (i = 0; i < list.length; i++) {
summary.push(list[i].innerText);
}
return summary;
});
console.log(results.join('\n'));
}
phantom.exit();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment