phantom-scraper

0.0.3 • Public • Published

Phantom Scraper

promise based interface to inject a script into a phantom browser and resolve a result

Usage

var phantomScraper = require('phantom-scraper');

var injectionPayload = function() {
  return jQuery('h1').text()
};

phantomScraper({
  uri: "http://example.com/",
  scriptInclude: "//code.jquery.com/jquery-latest.min.js",
  scriptEvaluate: injectionPayload,
  evaluationTimeout: 5000,
  noConflict: function() { $.noConflict(); }
})
.then(function(result){
  console.log('SCRAPE RESULTS:', result);
});

development

to run the development tests make sure mocha is installed with npm install -g mocha, then run npm test or mocha.

Package Sidebar

Install

npm i phantom-scraper

Weekly Downloads

0

Version

0.0.3

License

MIT

Last publish

Collaborators

  • diffalot