Comparing version 0.3.4 to 0.3.5
@@ -6,3 +6,3 @@ | ||
var request = require('request'), | ||
var http = require('http'), | ||
cheerio = require('cheerio'), | ||
@@ -65,10 +65,10 @@ uglify = require('uglify-js'), | ||
if (err) { | ||
callback(err, ''); | ||
callback(err, ''); | ||
} | ||
else { | ||
self.scripts = scripts; | ||
if (self.externalScripts) { | ||
self.echoMsg('Preparing to download external scripts....'); | ||
} | ||
self.loadScripts(); | ||
self.scripts = scripts; | ||
if (self.externalScripts) { | ||
self.echoMsg('Preparing to download external scripts....'); | ||
} | ||
self.loadScripts(); | ||
} | ||
@@ -94,4 +94,10 @@ }); | ||
request(website, function (err, response, body) { | ||
if (!err && response.statusCode === 200) { | ||
http.get(website, function (res) { | ||
var body = ''; | ||
res.on('data', function (chunk) { | ||
body += chunk; | ||
}); | ||
res.on('end', function () { | ||
var $ = cheerio.load(body); | ||
@@ -121,6 +127,6 @@ | ||
fn(false, scripts); | ||
} | ||
else { | ||
fn(err); | ||
} | ||
}); | ||
}) | ||
.on('error', function (err) { | ||
fn(err); | ||
}); | ||
@@ -143,4 +149,10 @@ }, | ||
request(parsedUrl, function (error, response, script) { | ||
if (!error && response.statusCode === 200) { | ||
http.get(parsedUrl, function (res) { | ||
var script = ''; | ||
res.on('data', function (chunk) { | ||
script += chunk; | ||
}); | ||
res.on('end', function () { | ||
if (flag) { | ||
@@ -154,5 +166,7 @@ self.echoMsg('Success: Loaded url without pathname: ' + parsedUrl); | ||
fn(false, script); | ||
} | ||
}); | ||
}) | ||
.on('error', function (error) { | ||
// Try again using base url without pathname | ||
else if (!flag) { | ||
if (!flag) { | ||
self.echoMsg('failed to load ' + parsedUrl + '\n Try again using base url without pathname'); | ||
@@ -164,3 +178,3 @@ self.loadScript(urlStr, website, fn, true); | ||
fn(error, ''); | ||
} | ||
} | ||
}); | ||
@@ -167,0 +181,0 @@ }, |
{ | ||
"name": "crushit", | ||
"version": "0.3.4", | ||
"version": "0.3.5", | ||
"description": "CrushIt is a commandline tool for crawling web pages and compiling scripts", | ||
@@ -29,3 +29,2 @@ "homepage": "http://qawemlilo.github.io/crushit/", | ||
"dependencies": { | ||
"request": "~2.34.0", | ||
"cheerio": "~0.13.1", | ||
@@ -32,0 +31,0 @@ "uglify-js": "~2.4.12", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
199048
3
860
2
- Removedrequest@~2.34.0
- Removedasn1@0.1.11(transitive)
- Removedassert-plus@0.1.5(transitive)
- Removedasync@0.9.2(transitive)
- Removedaws-sign2@0.5.0(transitive)
- Removedboom@0.4.2(transitive)
- Removedcombined-stream@0.0.7(transitive)
- Removedcryptiles@0.2.2(transitive)
- Removedctype@0.5.3(transitive)
- Removeddelayed-stream@0.0.5(transitive)
- Removedforever-agent@0.5.2(transitive)
- Removedform-data@0.1.4(transitive)
- Removedhawk@1.0.0(transitive)
- Removedhoek@0.9.1(transitive)
- Removedhttp-signature@0.10.1(transitive)
- Removedjson-stringify-safe@5.0.1(transitive)
- Removedmime@1.2.11(transitive)
- Removednode-uuid@1.4.8(transitive)
- Removedoauth-sign@0.3.0(transitive)
- Removedqs@0.6.6(transitive)
- Removedrequest@2.34.0(transitive)
- Removedsntp@0.2.4(transitive)
- Removedtldts@6.1.61(transitive)
- Removedtldts-core@6.1.61(transitive)
- Removedtough-cookie@5.0.0(transitive)
- Removedtunnel-agent@0.3.0(transitive)