Fix page error halting NPM driver

main
Elbert Alias 7 years ago
parent 086d50e839
commit 5c68a1503f

@ -30,7 +30,8 @@ $ node index.js https://wappalyzer.com
```javascript ```javascript
const options = { const options = {
userAgent: 'Wappalyzer', userAgent: 'Wappalyzer',
maxWait: 3000 maxWait: 3000,
debug: false
}; };
const wappalyzer = require('wappalyzer')(options); const wappalyzer = require('wappalyzer')(options);

@ -11,8 +11,6 @@ const driver = options => {
const json = JSON.parse(fs.readFileSync(__dirname + '/apps.json')); const json = JSON.parse(fs.readFileSync(__dirname + '/apps.json'));
return { return {
quiet: true,
analyze: url => { analyze: url => {
const wappalyzer = new Wappalyzer(); const wappalyzer = new Wappalyzer();
@ -25,7 +23,7 @@ const driver = options => {
return reject(message); return reject(message);
} }
if ( !driver.quiet ) { if ( Boolean(options.debug) ) {
console.log('[wappalyzer ' + type + ']', '[' + source + ']', message); console.log('[wappalyzer ' + type + ']', '[' + source + ']', message);
} }
}; };
@ -63,11 +61,12 @@ const driver = options => {
browser.visit(url, error => { browser.visit(url, error => {
if ( !browser.resources['0'].response ) { if ( !browser.resources['0'].response ) {
return reject('No response from server'); return wappalyzer.log('No response from server', 'driver', 'error');
} }
browser.wait(options.maxWait) browser.wait(options.maxWait)
.then(() => { .catch(error => wappalyzer.log(error.message, 'browser'))
.finally(() => {
wappalyzer.driver.document = browser.document; wappalyzer.driver.document = browser.document;
const headers = {}; const headers = {};
@ -86,8 +85,7 @@ const driver = options => {
html, html,
env: vars env: vars
}); });
}) });
.catch(error => reject(error));
}); });
}); });
} }

@ -2,7 +2,8 @@
const options = { const options = {
userAgent: null, userAgent: null,
maxWait: 3000 maxWait: 3000,
debug: false
}; };
const args = process.argv.slice(2); const args = process.argv.slice(2);

@ -313,7 +313,7 @@ wappalyzer.driver.ping = (hostnameCache, adCache) => {
.then(tracking => { .then(tracking => {
if ( tracking ) { if ( tracking ) {
if ( Object.keys(hostnameCache).length ) { if ( Object.keys(hostnameCache).length ) {
post('http://ping.wappalyzer.com/v2/', hostnameCache); post('http://ping.wappalyzer.com/v3/', hostnameCache);
} }
if ( adCache.length ) { if ( adCache.length ) {

Loading…
Cancel
Save