Skip to content

Instantly share code, notes, and snippets.

@vector623
Created July 16, 2017 20:06
Show Gist options
  • Save vector623/c37434e04f565fcc4b733d3a59f2892f to your computer and use it in GitHub Desktop.
Save vector623/c37434e04f565fcc4b733d3a59f2892f to your computer and use it in GitHub Desktop.
var page = require('webpage').create();
page.open('http://davidgallmeier.com', function() {
page.includeJs("http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js", function() {
var results = page.evaluate(function() {
var firstlinktext = $('a.post-link:first').
text().
toString();
var firstlinkhref = $('a.post-link').
map(function () {
return $( this ).attr('href');
})[0].
toString();
//return firstlinktext;
return firstlinkhref;
});
console.log(results);
phantom.exit()
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment