I have HTML webpages that I am crawling using xpath. The etree.tostring
of a certain node gives me this string:
<script>
<!--
function escramble_758(){
var a,b,c
a='+1 '
b='84-'
a+='425-'
b+='7450'
c='9'
document.write(a+c+b)
}
escramble_758()
//-->
</script>
I just need the output of escramble_758()
. I can write a regex to figure out the whole thing, but I want my code to remain tidy. What is the best alternative?
I am zipping through the following libraries, but I didnt see an exact solution. Most of them are trying to emulate browser, making things snail slow.
- http://code.google.com/p/python-spidermonkey/ (clearly says
it's not yet possible to call a function defined in Javascript
) - http://code.google.com/p/webscraping/ (don't see anything for Javascript, I may be wrong)
- http://pypi.python.org/pypi/selenium (Emulating browser)
Edit: An example will be great.. (barebones will do)