How can I know that site is refusing a zombie.js connection?

175 views
Skip to first unread message

Daniel Lopez Gonzalez

unread,
Dec 7, 2015, 5:37:26 AM12/7/15
to zombie.js
I am triying to use zombie.js to build an scraper worker in nodejs. I found a site that returns me this error:


TypeError: Cannot set property '_load3po' of undefined
    at d.1.i (https://[SITE]/layout/assets/perflibLoader-v2.4.3-6d85819256.js:1:2216)
    at Object.d.1 (https://[SITE]/layout/assets/perflibLoader-v2.4.3-6d85819256.js:1:2757)
    at r (https://[SITE]/layout/assets/perflibLoader-v2.4.3-6d85819256.js:1:254)
    at e (https://[SITE]/layout/assets/perflibLoader-v2.4.3-6d85819256.js:1:421)
    at https://[SITE]/layout/assets/perflibLoader-v2.4.3-6d85819256.js:1:438
    at Object.exports.runInContext (vm.js:44:17)
    at window._evaluate ([path]\node_modules\zombie\lib\document.js:253:75)
    at Object.DOM.languageProcessors.javascript ([path]\node_modules\zombie\lib\dom\scripts.js:26:12)
    at define.proto._eval ([path]\node_modules\zombie\node_modules\jsdom\lib\jsdom\level2\html.js:1477:47)
    at [path]\node_modules\zombie\node_modules\jsdom\lib\jsdom\browser\resource-loader.js:32:22
    in https://[SITE]/...

I use zombie.js with custom agent.

var user_agent = 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36';
...
var browser = new Browser({userAgent: user_agent, debug: false, waitFor: 30*1000, waitDuration: 29*1000});

May this be a zombie.js bug or can this be a trick to throw out headleass-browsers like zombie.js?

Thank you. Awesome tool.

Daniel Lopez Gonzalez

unread,
Dec 7, 2015, 5:43:51 AM12/7/15
to zombie.js
More info about the error:

The javascript is ofuscated but I have could see what is happening:

_load3po is property created in this way:

JS CODE:

i = window
...
return i.open()._load3po = function() {
                    ...
                },  

I am going to test is zombie.js can process this. 

Daniel Lopez Gonzalez

unread,
Dec 8, 2015, 2:38:03 PM12/8/15
to zombie.js
Last news.

This issue only happens when I use third package to syncronized the calls. At the momento, this ocurrs with "asyncawait" and with "synchronize.js";

Code with asyncawait:

var browser = new Browser({userAgent: user_agent, debug: false, waitFor: 30*1000, waitDuration: 29*1000});
var async = require('asyncawait/async');
var await = require('asyncawait/await');
 
var foo = async (function() {
    var url = '[SITE]';
    console.log('visiting');    
    var resultA = await (browser.visit(url));
    console.log('selecting');        
    ...
    return 1;
});
 

console.log('app start');
foo();
console.log('after launch');

Code with syncronized.js

    var fiber = sync.fiber;
    var await = sync.await;
    var defer = sync.defer;
    try {
        fiber(function() {

            var browser = new Browser({userAgent: user_agent, debug: false, waitFor: 30*1000, waitDuration: 29*1000});       
            var url = [SITE];
                      browser.visit(url);
        });
    } catch(err) {
        //TODO Handle error
    } 

In other hand, when I use zombie.js with callback code style, the browser connect and parse to the page without any problem.

Any ideas about this?

Thank you.
Reply all
Reply to author
Forward
0 new messages