0.0.3 • Published 10 years ago
phantom-scraper v0.0.3
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
.