Comparing version 0.0.1 to 0.0.2
@@ -7,4 +7,5 @@ var deps = module.exports; | ||
deps.getbinpath = function(module) { | ||
var modpath = require.resolve(module).split('/'); | ||
var phantomidx = modpath.indexOf(module); | ||
log.debug('function getbinpath: ' + module); | ||
var modpath = require.resolve('shelljs').split('/'); | ||
var phantomidx = modpath.indexOf('shelljs'); | ||
var binpath = modpath.slice(0, phantomidx); | ||
@@ -14,3 +15,4 @@ binpath.push('.bin'); | ||
binpath = binpath.join('/'); | ||
log.debug('path for module :' + module + ': ' + binpath); | ||
return(binpath); | ||
}; |
var thresher = module.exports; | ||
var winston = require('winston'); | ||
log = new (winston.Logger)({ | ||
transports: [ | ||
new (winston.transports.Console)({ level: 'info' }) | ||
] | ||
}); | ||
log.cli(); | ||
thresher.deps = require('./dependencies.js'); | ||
@@ -4,0 +12,0 @@ thresher.dom = require('./dom.js'); |
require('shelljs/global'); | ||
var deps = require('./dependencies.js'); | ||
env['PHANTOMJS_EXECUTABLE'] = deps.getbinpath('phantomjs'); | ||
// SpookyJS provides our bridge to CasperJS and PhantomJS | ||
@@ -35,2 +33,3 @@ var Spooky = require('spooky'); | ||
var settings = function(loglevel) { | ||
env['PHANTOMJS_EXECUTABLE'] = deps.getbinpath('phantomjs'); | ||
return { | ||
@@ -68,2 +67,3 @@ child: { | ||
scrape.scrape = function(scrapeUrl, definition, cb, loglevel) { | ||
log.debug('function scrape: ' + scrapeUrl); | ||
@@ -74,3 +74,5 @@ // validate arguments | ||
// let's get our scrape on | ||
log.debug('creating spooky instance'); | ||
var spooky = new Spooky(settings(loglevel), function() { | ||
log.debug('spooky initialising'); | ||
spooky.start(scrapeUrl); | ||
@@ -77,0 +79,0 @@ |
@@ -12,2 +12,3 @@ var url = module.exports; | ||
url.checkUrl = function(theUrl) { | ||
log.debug('function checkUrl: ' + theUrl); | ||
var protocol = /^(f|ht)tps?:\/\//i.test(theUrl); | ||
@@ -14,0 +15,0 @@ var domain = /:\/\/\w+\.\w+/i.test(theUrl); |
{ | ||
"name": "thresher", | ||
"description": "Headless ScraperJSON scraping for Node.js", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"homepage": "https://github.com/ContentMine/quickscrape", | ||
@@ -6,0 +6,0 @@ "author": { |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
34746
900
2