Giter Club home page Giter Club logo

node-chimera's Introduction

Chimera: A new kind of phantom for NodeJS

I was inspired by PhantomJS and wanted something similar, but could be run inside of the nodejs environment, without calling out to an external process. PhantomJS is run as an external process that users can run under any language, however one must create a fancy glue wrapper so that development isn't impaired. I created something that does exactly what phantomjs is capable of doing, except in a full js environment, called Chimera.

Installation

Installing is simple via npm:

npm install chimera

It will download the native chimera binary in the postinstall script. Currently we have binaries for 64bit darwin (mac), and 64bit linux. If you use something different, you may have to compile your own or wait for me to build one for your platform.

Usage

The most basic skeleton should look something like this:

var Chimera = require('chimera').Chimera;

var c = new Chimera();
c.perform({
  url: "http://www.google.com",
  locals: {

  },
  run: function(callback) {
    callback(null, "success");
  },
  callback: function(err, result) {

  }
});

When you instantiate a new chimera with new Chimera(), you're actually creating a new browser instance which does not share session data with other browser sessions. It has it's own in memory cookie database and url history.

The locals hash should contain variables you wish to pass to the web page. These values should be types that can be turned into json because the sandboxing environment of the browser's js engine prevents us from passing actual nodejs variable references.

The run function is run immediately as the page is loaded. You may wish to wait until the entire page is loaded before you perform your logic, so you'd have to do the same stuff that you'd do in normal javascript embedded in webpages. For example, if you were using jquery, you'd be doing the standard $(document).ready(function(){stuff}) type of code to wait for the page to fully load. Keep in mind that the run function is run inside the webpage so you won't have access to any scoped variables in nodejs. The callback parameter should be called when you're ready to pause the browser instance and pass control back to the nodejs world.

The callback function is run in the nodejs context so you'll have access to scoped variables as usual. This function is called when you call the callback function from inside of run().

Chimera options

var c = new Chimera({
  userAgent: 'Mozilla/5.0 (Windows NT 6.2) AppleWebKit/536.6 (KHTML, like Gecko) Chrome/20.0.1090.0 Safari/536.6',
  libraryCode: '(function() { window.my_special_variable = 1234; })()',
  cookies: '',
  disableImages: true
});

Here are all the possible options available when creating a new browser instance:

  • userAgent: Any string that represents a user agent. By default it uses the one shown in the example, a windows chrome browser.
  • libraryCode: If you want to inject jquery into all your webpages, you should do something like fs.readFileSync("jquery.js") here.
  • cookies: as seen in later examples, you can save the cookies from a previous browser instance and use them here
  • disableImages: If you don't need images in your scraper, this can drastically reduce memory and speed up webpages. However, your screenshots may look like crap.

A simple login example

In the example code below, we show how to login to a website using a native mouse button click on the submit button, then load a second browser instance using the logged in cookies from the first browser instance.

var Chimera = require('chimera').Chimera;

var myUsername = "my_username";
var myPassword = "my_password";

var c = new Chimera();
c.perform({
  url: "http://www.mywebsite.com",
  locals: {
    username: myUsername,
    password: myPassword
  },
  run: function(callback) {
    // find the form fields and press submit
    pos = jQuery('#login-button').offset()
    window.chimera.sendEvent("click", pos.left + 10, pos.top + 10)
  },
  callback: function(err, result) {
    // capture a screen shot
    c.capture("screenshot.png");

    // save the cookies and close out the browser session
    var cookies = c.cookies();
    c.close();

    // Create a new browser session with cookies from the previous session
    var c2 = new Chimera({
      cookies: cookies
    });
    c2.perform({
      url: "http://www.mywebsite.com",
      run: function(callback) {
        // You're logged in here!
      },
      callback: function(err, result) {
        // capture a screen shot that shows we're logged in
        c2.capture("screenshot_logged_in.png");
        c2.close();
      }
    });
  }
});

A few notes

In the example above, you may notice window.chimera.sendEvent(). The chimera variable is a global inside webpages and allow you to call functions that you otherwise wouldn't be able to. You can take a screenshot with chimera.capture() for example.

When we are in the callback() for the first browser instance, we nab the cookies via c.cookies(). If you inspect the cookies, you'll see that it's just a giant string containing the domain, keys, and values. This may contain http & https cookies as well, which are normally not accessible via javascript from inside the webpage. You'll also probably notice there are cookies from tracking companies like google analytics or mixpanel. The cookies string will basically contain everything that a browser may have. If you want to remove the google analytics cookies, you'll have to parse the cookie string and remove them manually yourself. There are many cookie parsers out there -- check out the one that is included in the expressjs middleware if you need something quick and dirty.

A bad example

Here's a few things that you should not do.

var c = new Chimera();
var fs = require('fs');
c.perform({
  url: "http://www.mywebsite.com",
  locals: {
    fs: fs
  },
  run: function(callback) {
    var os = require('os');
  },
  callback: function(err, result) {
    
  }
});

In the above example, we try to pass the fs variable as a local variable. We can't do this because fs cannot be turned into a json string. Just because it looks like it might work, it won't. The sandbox in the web browser prevents scoped variables from being available.

A second thing wrong is that the run() function doesn't perform the callback function with callback(). If you do this, the context will never be passed back to the nodejs world so you'll be wondering why you can't scrape anything.

The third thing wrong here is that inside the run() function, we're trying to call require('os'). The require function pulls from the nodejs scoped context which isn't available inside the webpage. You only have access to typical variables in a webpage like window.document etc.

Compiling your own version

Since this library does use native libraries, I may not have a native version for your platform (people have been asking me about arm-linux and sunos). Hopefully I can describe how one can compile this under your platform, and perhaps we can move to something easier.

Compiling on the mac:

Getting a binary on the mac is fairly easy, but it does take a long time to compile Qt. Unlike Linux, you don't need the custom openssl included with chimera. Here's the basic steps to take the mac:

./scripts/compile_qt.sh
./scripts/compile_binary.sh

The final binary should be inside of node-chimera/lib.

Compiling on linux:

You'll need the ssl headers, freetype, and fontconfig libraries first, so you'll have to install with a command like:

apt-get install libfreetype6-dev libfontconfig1-dev libssl-dev

Since nodejs comes with it's own version of ssl, we have to make Qt also use this version of ssl or else we'll have segfaults. Compile the openssl included first (we have some additional flags like -fPIC which allow the libraries to be statically included later on). Here are all the steps required to build chimera:

./scripts/compile_openssl.sh
./scripts/compile_qt.sh
./scripts/compile_binary.sh

The final chimera.node binary should exist inside the node-chimera/lib directory. If you don't see it in there, something bad probably happened along the way.

node-chimera's People

Contributors

deanmao avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-chimera's Issues

Problem during installation

Working on Windows7 64-Bit, getting the following error:

C:\workspace-js\nodejs-example>npm install chimera
npm info it worked if it ends with ok
npm info using [email protected]
npm info using [email protected]
npm info trying registry request attempt 1 at 13:29:54
npm http GET https://registry.npmjs.org/chimera
npm http 200 https://registry.npmjs.org/chimera
npm info retry fetch attempt 1 at 13:29:55
npm http GET https://registry.npmjs.org/chimera/-/chimera-0.3.2.tgz
npm http 200 https://registry.npmjs.org/chimera/-/chimera-0.3.2.tgz
npm info install [email protected] into C:\workspace-js\nodejs-example
npm info installOne [email protected]
npm info C:\workspace-js\nodejs-example\node_modules\chimera unbuild
npm info preinstall [email protected]
npm info trying registry request attempt 1 at 13:29:56
npm http GET https://registry.npmjs.org/request
npm http 200 https://registry.npmjs.org/request
npm info retry fetch attempt 1 at 13:29:56
npm http GET https://registry.npmjs.org/request/-/request-2.12.0.tgz
npm http 200 https://registry.npmjs.org/request/-/request-2.12.0.tgz
npm info install [email protected] into C:\workspace-js\nodejs-example\node_modules\chimera
npm info installOne [email protected]
npm info C:\workspace-js\nodejs-example\node_modules\chimera\node_modules\request unbuild
npm info preinstall [email protected]
npm info build C:\workspace-js\nodejs-example\node_modules\chimera\node_modules\request
npm info linkStuff [email protected]
npm info build C:\workspace-js\nodejs-example\node_modules\chimera\node_modules\request\node_modules\form-data
npm info preinstall [email protected]
npm info linkStuff [email protected]
npm info install [email protected]
npm info postinstall [email protected]
npm info build C:\workspace-js\nodejs-example\node_modules\chimera\node_modules\request\node_modules\mime
npm info preinstall [email protected]
npm info linkStuff [email protected]
npm info install [email protected]
npm info postinstall [email protected]
npm info install [email protected]
npm info postinstall [email protected]
npm info build C:\workspace-js\nodejs-example\node_modules\chimera
npm info linkStuff [email protected]
npm info install [email protected]
npm info postinstall [email protected]

> [email protected] postinstall C:\workspace-js\nodejs-example\node_modules\chimera
> node scripts/download_native_binary.js

downloading chimera native binary for: win32_x64

stream.js:94
      throw er; // Unhandled stream error in pipe.
            ^
Error: getaddrinfo ENOTFOUND
    at errnoException (dns.js:37:11)
    at Object.onanswer [as oncomplete] (dns.js:124:16)
npm info [email protected] Failed to exec postinstall script
npm info C:\workspace-js\nodejs-example\node_modules\chimera unbuild
npm info preuninstall [email protected]
npm info uninstall [email protected]
npm info postuninstall [email protected]
npm ERR! weird error 8
npm ERR! not ok code 0

QWaitCondition error

Just ran npm install and created a script from the first example in the readme opening google.com) and got this in my console output:

Using the chimera in lib
QWaitCondition: cv destroy failure: Resource busy

Do I have to delve into QT to get to the bottom of this or is there something obvious I could fix in Chimera to resolve this?

compile on linux

how did you compile qt 4.8 on linux since the makefile tries to run xcodebuild?

Error wrong ELF class: ELFCLASS64 in Ubuntu 32bit

I try Chimera with code below

lib/spider.js

var chimera = require('chimera').Chimera;

var Chimera = new chimera();

Chimera.perform({
    url: 'http://google.com',
    run: function(callback) {
        callback(null, 'success');
    },
    callback: function(err, result) {
        console.log('here are the cookies');
        console.log(Chimera.cookies());
    }
});

Stack trace

module.js:485
  process.dlopen(filename, module.exports);
          ^
Error: /xxx/project/node_modules/chimera/native/linux/v0.8/chimera.node: wrong ELF class: ELFCLASS64
    at Object.Module._extensions..node (module.js:485:11)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:362:17)
    at require (module.js:378:17)
    at Object.<anonymous> (/xxx/project/node_modules/chimera/lib/main.js:6:14)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)

node -v

v0.8.8

uname -a

Linux xxx 3.2.0-35-generic-pae #55-Ubuntu SMP Wed Dec 5 18:04:39 UTC 2012 i686 i686 i386 GNU/Linux

cat /etc/lsb-release

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=12.04
DISTRIB_CODENAME=precise
DISTRIB_DESCRIPTION="Ubuntu 12.04.1 LTS"

Add Proxy support

Be able to specify a proxy server to use along with cookies, user agent, etc.

Compiling path is set wrong on OSX

Can node-gyp configure and node-gyp make fine however when trying to node example for any of the examples, the following error happens.

module.js:356
  Module._extensions[extension](this, filename);
                               ^
Error: dlopen(/Users/levi/.../node-chimera/build/Release/chimera.node, 1): 
Library not loaded: /Volumes/thumb/node-chimera/qt/lib/libQt5Gui.5.dylib
  Referenced from: /Users/levi/.../node-chimera/build/Release/chimera.node
  Reason: image not found

It should be noted that I do NOT have the path
/Volumes/thumb/node-chimera/qt/lib/

In fact I do not even have the volume thumb.

I have a reason to believe this has something to do with XCode setting the wrong path however could not find any way to change it. I also browsed through the source a little bit but haven't come across anything yet except for the following.

In biinding.gyp line 32 has:

'xcode_settings': {
    'OTHER_LDFLAGS': [
        '-Wl,-rpath <(module_root_dir)/qt/lib'
    ]
}

WebRTC Support

What version of chrome does Chimera support and does it support WebRTC?

Segmentation fault: 11

Trying out chimera today, and I'm getting the Seg Fault: 11 error others have reported. I used npm install chimera just a few minutes ago. I tried doing gdb node to run my script, and this is the result:

(gdb) run app.coffee 
Starting program: /usr/local/bin/node app.coffee
Reading symbols for shared libraries ++++................................................................................................................................. done
Using the chimera in lib
Reading symbols for shared libraries warning: Could not find object file "/Users/catch23/current/node-chimera/build/Release/obj.target/chimera/src/top.o" - no debug information available for "top.cc".

warning: Could not find object file "/Users/catch23/current/node-chimera/build/Release/obj.target/chimera/src/cookiejar.o" - no debug information available for "cookiejar.cc".

warning: Could not find object file "/Users/catch23/current/node-chimera/build/Release/obj.target/chimera/src/chimera.o" - no debug information available for "chimera.cc".

warning: Could not find object file "/Users/catch23/current/node-chimera/build/Release/obj.target/chimera/src/browser.o" - no debug information available for "browser.cc".

......... done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000007
0x0000000102d0cee8 in QString::fromLocal8Bit ()

Looks like there are some hardcoded paths for libraries preventing chimera from running (my user is not catch23)?

Click each element then scrape

Is there a way I could loop through each h2 element click it then scrape? This would be because the h2 elements are closed and it would be good to expand them to see the data and then extract the data. Since these elements don't already have click events, I assume this will need to somehow be hooked to it? But i'm not quite sure how to do this. I have had trouble previously with PhantomJS executing javascript like this before scraping because only PhantomJS 2.x was able to do what i required.

What i think the code might look like BUT where/how do i implement this for chimera to invoke?

`
var selector = 'h2';
function (selector) {
var els = $(selector);
$.each(els, function (idx, el) {
var event = document.createEvent('MouseEvent');
event.initEvent('click', true, true);
el.dispatchEvent(event);
});

    }, SELECTOR`

no longer being maintained?

Judging by the number of pull requests opened - some of which are many months old, is it fair to say that this project is no longer being worked on?

handling errors

how to handle errors ?

  • when i call callback('foo', 'bar'), callback function i called like callback(null, 'bar')
  • when error really happend in run function, the process just die silently
  • when i request a page that does not exist, error 500, or something similar, the process just die silently

Please support sunos_x64 platform install (for nodejitsu)

I get the following error when trying to deploy my app with nodejitsu.
The app runs fine on OSX, but from the release notes I gather chimera doesn't support SunOS?

error: Error running command deploy
error: Nodejitsu Error (500): Internal Server Error
error: npm http GET http://nj-npm.irisnpm.com/chimera
npm http 200 http://nj-npm.irisnpm.com/chimera
npm http GET http://nj-npm.irisnpm.com/chimera/-/chimera-0.3.2.tgz
npm http 200 http://nj-npm.irisnpm.com/chimera/-/chimera-0.3.2.tgz
npm http GET http://nj-npm.irisnpm.com/request
npm http 200 http://nj-npm.irisnpm.com/request
npm http GET http://nj-npm.irisnpm.com/request/-/request-2.12.0.tgz
npm http 200 http://nj-npm.irisnpm.com/request/-/request-2.12.0.tgz

[email protected] postinstall /root/tmp/tmp-6507ftvj2rk/build/package/node_modules/chimera
node scripts/download_native_binary.js

downloading chimera native binary for: sunos_x64

stream.js:81
throw er; // Unhandled stream error in pipe.
^
Error: incorrect header check
at Zlib._binding.onerror (zlib.js:283:17)
npm ERR! [email protected] postinstall: node scripts/download_native_binary.js
npm ERR! sh "-c" "node scripts/download_native_binary.js" failed with 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is most likely a problem with the chimera package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node scripts/download_native_binary.js
npm ERR! You can get their info via:
npm ERR! npm owner ls chimera
npm ERR! There is likely additional logging output above.

npm ERR! System SunOS 5.11
npm ERR! command "/opt/local/bin/node" "/opt/local/bin/npm" "install"
npm ERR! cwd /root/tmp/tmp-6507ftvj2rk/build/package
npm ERR! node -v v0.8.16
npm ERR! npm -v 1.1.69
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /root/tmp/tmp-6507ftvj2rk/build/package/npm-debug.log
npm ERR! not ok code 0

Error loading native lib on OSX Lion 10.7.5

Minimal code

var Chimera = require('chimera').Chimera

var c = new Chimera()

c.perform({
  url: 'http://localhost:7357',
  locals: {},
  run: function(){},
  callback: function(){}
})

Output

$ node play.js
Using the chimera in lib
Error loading chimera in lib

/Users/airportyh/Home/Code/chimera_hello/node_modules/chimera/lib/main.js:29
setInterval(webkit.processEvents, 50);
                  ^
TypeError: Cannot read property 'processEvents' of undefined
    at Object.<anonymous> (/Users/airportyh/Home/Code/chimera_hello/node_modules/chimera/lib/main.js:29:19)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/Users/airportyh/Home/Code/chimera_hello/play.js:1:77)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)

Debugged into it to get more detailed error when trying to load native lib

Error: dlopen(/Users/airportyh/Home/Code/chimera_hello/node_modules/chimera/lib/chimera.node, 1): no suitable image found.  Did find:\n\t/Users/airportyh/Home/Code/chimera_hello/node_modules/chimera/lib/chimera.node: truncated mach-o error: segment __TEXT extends to 24543232 which is past end of file 13159175

problem during installation

It throws the following error during installation


> [email protected] postinstall /home/*/projects/logged-in-crawler/node_modules/chimera
> node scripts/download_native_binary.js

downloading chimera native binary for: linux_x64

stream.js:94
      throw er; // Unhandled stream error in pipe.
            ^
Error: getaddrinfo ENOTFOUND
    at errnoException (dns.js:37:11)
    at Object.onanswer [as oncomplete] (dns.js:124:16)
npm ERR! [email protected] postinstall: `node scripts/download_native_binary.js`
npm ERR! Exit status 8
npm ERR! 
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is most likely a problem with the chimera package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node scripts/download_native_binary.js
npm ERR! You can get their info via:
npm ERR!     npm owner ls chimera
npm ERR! There is likely additional logging output above.

npm ERR! System Linux 3.8.0-38-generic
npm ERR! command "/home/*/v0.10.22/bin/node" "/home/*/v0.10.22/bin/npm" "install" "chimera"
npm ERR! cwd /home/*/projects/logged-in-crawler
npm ERR! node -v v0.10.22
npm ERR! npm -v 1.3.14
npm ERR! code ELIFECYCLE
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/*/projects/logged-in-crawler/npm-debug.log
npm ERR! not ok code 0


QNetworkReplyImplPrivate error

Hi,

i got parallel jobs and this error displayed :

QNetworkReplyImplPrivate::error: Internal problem, this method must only be called once.

it looks to work anyway

Chimera thread doesnt close.

Hello,
Im using nodejs v0.8.23-pre (Chimera doesnt work with 0.10.x) on Ubuntu 12.10 x64.
For now everything works except close() method. Even with simple example script like:

var c = new Chimera();
c.perform({
url: "http://www.google.com",
locals: {
},
run: function(callback) {
callback(null, "success");
},
callback: function(err, result) {
console.log(status)
c.close();
}
});

Script doesnt end, and chimera thread is kept till i kill nodejs process.

Building on Ubuntu x64

I'm trying to build on Ubuntu 12.04 so that I can start to poke around with the binding and test some changes.

Steps Taken:

This fails:

platform/qt/WheelEventQt.cpp: In constructor ‘WebCore::PlatformWheelEvent::PlatformWheelEvent(QGraphicsSceneWheelEvent*)’:
platform/qt/WheelEventQt.cpp:62:19: error: invalid use of incomplete type ‘struct QGraphicsSceneWheelEvent’
platform/PlatformWheelEvent.h:42:7: error: forward declaration of ‘struct QGraphicsSceneWheelEvent’
platform/qt/WheelEventQt.cpp:63:25: error: invalid use of incomplete type ‘struct QGraphicsSceneWheelEvent’
platform/PlatformWheelEvent.h:42:7: error: forward declaration of ‘struct QGraphicsSceneWheelEvent’
platform/qt/WheelEventQt.cpp:66:19: error: invalid use of incomplete type ‘struct QGraphicsSceneWheelEvent’
platform/PlatformWheelEvent.h:42:7: error: forward declaration of ‘struct QGraphicsSceneWheelEvent’
platform/qt/WheelEventQt.cpp:67:18: error: invalid use of incomplete type ‘struct QGraphicsSceneWheelEvent’
platform/PlatformWheelEvent.h:42:7: error: forward declaration of ‘struct QGraphicsSceneWheelEvent’
platform/qt/WheelEventQt.cpp:68:17: error: invalid use of incomplete type ‘struct QGraphicsSceneWheelEvent’
platform/PlatformWheelEvent.h:42:7: error: forward declaration of ‘struct QGraphicsSceneWheelEvent’
platform/qt/WheelEventQt.cpp:69:18: error: invalid use of incomplete type ‘struct QGraphicsSceneWheelEvent’
platform/PlatformWheelEvent.h:42:7: error: forward declaration of ‘struct QGraphicsSceneWheelEvent’
platform/qt/WheelEventQt.cpp:73:17: error: invalid use of incomplete type ‘struct QGraphicsSceneWheelEvent’
platform/PlatformWheelEvent.h:42:7: error: forward declaration of ‘struct QGraphicsSceneWheelEvent’
platform/qt/WheelEventQt.cpp:73:29: error: invalid use of incomplete type ‘struct QGraphicsSceneWheelEvent’
platform/PlatformWheelEvent.h:42:7: error: forward declaration of ‘struct QGraphicsSceneWheelEvent’
make: *** [.obj/release-static/WheelEventQt.o] Error 1

This results in libQtWebKit.a not being available for the compile_binary step.

I've had the same issue on an 11.04 and 12.04 machine (the second installed from scratch).

Any ideas?

I'll try with qt 5.0.1 as well shortly.

License

Nice one - a reference to this project popped up on twitter today via NodeJs Community

Any interest in making chimera available under an alternate license like MIT?
I think the first node module I've seen with GPL applied.

I'm still working my way through various assessments of license compatibility but may have an issue using it going forward, and I'd really like to - it blows away my own effort in wrapping QtWebKit.

Cheers

QWaitCondition error

Hi,

I saw this issue #12 and i got it myself running linux (arch)

QWaitCondition: cv destroy failure: Device or resource busy
QWaitCondition: mutex destroy failure: Device or resource busy
zsh: segmentation fault (core dumped)  ./index.js

How can we fix this ?

PDF rendering

The capture function does a nice job of rendering a pdf but is their a way to set the viewport, orientation, and margin? If not would this be possible with Chimera?

`npm install chimera` on ubuntu installs broken chimera

Fresh instance of Ubuntu 12 on AWS, upgrade to node.js 0.8.17, then create a new node.js project and do the old 'npm install chimera'.

Then run 'node index2.js' (using sample code from READM.md) I get this:

Error loading chimera in lib

/home/ubuntu/talous/node_modules/chimera/lib/main.js:29
setInterval(webkit.processEvents, 50);
^
TypeError: Cannot read property 'processEvents' of undefined
at Object. (/home/ubuntu/talous/node_modules/chimera/lib/main.js:29:19)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:362:17)
at require (module.js:378:17)
at Object. (/home/ubuntu/talous/index2.js:1:77)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)

re-encoding of redirect url

hi dean. first off thanks for chimera - exactly what i was looking for.

I have this scenario causing me an issue (unsure if this is a chimera/webkit issue?):

Load www.example.com?signature=w%3D%3D--123456 in chimera

It redirects to www.example.com/auth/login

I process the form in chimera, and submit

However, when chimera then gets the redirect after auth, the url its trying to redirect to is double encoded - so the % gets reencoded to %25

www.example.com?signature=w%253D%253D--123456

All the steps work when I do it manually in browser, so just wondering if this is potentially a problem in chimera/webkit, or outside the scope

thanks

Won't install with node v0.11.10

When trying to install chimera using node v0.11.10, I get this error:

npm http GET https://registry.npmjs.org/chimera
npm http 304 https://registry.npmjs.org/chimera
npm http GET https://registry.npmjs.org/request
npm http 304 https://registry.npmjs.org/request

> [email protected] postinstall /home/isaac/fez-qunit/node_modules/chimera
> node scripts/download_native_binary.js

downloading chimera native binary for: linux_x64

stream.js:94
      throw er; // Unhandled stream error in pipe.
            ^
Error: incorrect header check
    at Zlib._binding.onerror (zlib.js:323:17)
npm ERR! [email protected] postinstall: `node scripts/download_native_binary.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is most likely a problem with the chimera package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node scripts/download_native_binary.js
npm ERR! You can get their info via:
npm ERR!     npm owner ls chimera
npm ERR! There is likely additional logging output above.

npm ERR! System Linux 3.12.6-1-ARCH
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "install" "--save" "chimera"
npm ERR! cwd /home/isaac/fez-qunit
npm ERR! node -v v0.11.10
npm ERR! npm -v 1.3.22
npm ERR! code ELIFECYCLE
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/isaac/fez-qunit/npm-debug.log
npm ERR! not ok code 0

More detail api

Is it posible to add some more detail api? , refer to phantomjs, such as pageload, request event.

Error Object is Always null

The error parameter of callback is always null. Also, chimera does not terminate in Ubuntu, as mentioned in #9.

var Chimera = require("chimera").Chimera;
var chimera = new Chimera();

chimera.perform({
url: "http://www.google.com",
locals: {
},
run: function(callback) {
callback("foo", "bar");
},
callback: function(err, result) {
console.log(arguments);
chimera.close();
}
});

Windows Binary

Could we please get windows binaries? I know its possible for me to build this myself, but its pretty daunting for some one with little knowledge of the project.

qt folder missing in project root

I installed Chimera using npm install but it didn't create a qt folder in the chimera/ project root folder. This means the manual compile instructions fail (no folder qt to cd in to).

Add option to ignore SSL errors.

I'm looking at using Chimera for testing. My dev machine uses a self-signed certificate and this looks to be preventing Chimera from successfully loading pages. I see that PhantomJS has an option for ignoring SSL errors (ignoreSslErrors) and I think a similar option would be useful in Chimera.

node v0.10.x

Hi,

I've got the following error while trying to requiring chimera.node using node v0.10.0, and seems to work with v0.8.x

$ node        
> require('./chimera')
Error: Module version mismatch. Expected 11, got 1.
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at repl:1:2
    at REPLServer.self.eval (repl.js:110:21)
    at Interface.<anonymous> (repl.js:239:12)
    at Interface.EventEmitter.emit (events.js:95:17)
    at Interface._onLine (readline.js:202:10)
    at Interface._line (readline.js:531:8)

Thx

By the way, is the project still supported ?

Ability to Silence WebKit

Is there a way to silence WebKit messages? For example, messages about insecure content when a HTTPS site loads a HTTP resource. This would be a great feature to have.

chimera is not terminating

Hey,

i just tried out your example on a mac

var Chimera = require('chimera').Chimera;

var c = new Chimera();
c.perform({
  url: "http://www.google.com",
  locals: {

  },
  run: function(callback) {
    callback(null, "success");
  },
  callback: function(err, result) {
    console.log('finished', err, result);
    c.close()
  }
});

if i execute the script with node chimera.js i get the 'finished' message, but the script is stil running.

how can i terminate the script in a safe manner?

cheers mark

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.