Question

I have successfully installed Spidermonkey JS engine on my Linux machine ( Ubuntu ). Basically my goal is to make it execute Ajax (js) scripts and return the result back to my Python script. I'm basically trying to build a good O.O. web scraper. But it's pretty hard for me to get all of this working.

I'm now at the point where when I type JS in my terminal I can start executing Javascript. I've been Googling and found this little snipet on Stackoverflow :

import urllib2
import spidermonkey
js = spidermonkey.Runtime()
js_ctx = js.new_context()
script = urllib2.urlopen('http://etherhack.co.uk/hashing/whirlpool/js/whirlpool.js').read()
js_ctx.eval_script(script)
js_ctx.eval_script('var s="abc"')
js_ctx.eval_script('print(HexWhirpool(s))')

but it failed to run with the error that module Spidermonkey can not be found.

I'm a bit lost now. Anyone able to help?

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top