Python: Processing Javascript with urllib2?

吃可爱长大的小学妹 提交于 2019-12-04 23:55:48

问题


I am coding a HTML scraper which gets values from a table on a website. I also need to grab the URL of an image, but the problem is this image is dynamically generated via javascript - and when i get contents of the website via urllib, the Javascript does not run or show in the resulting HTML.

Is there any way to enable Javascript to run on pages which are accessed via urllib?


回答1:


No, you'd need some sort of JS interpreter for that. There might be Python-Browser integrations to help parsing this kind of page.




回答2:


Drive by suggestion: look into pydermonkey.



来源:https://stackoverflow.com/questions/4720342/python-processing-javascript-with-urllib2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!