Python:用urllib2处理Javascript? [英] Python: Processing Javascript with urllib2?

查看:108
本文介绍了Python:用urllib2处理Javascript?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个HTML抓取器,它从网站上的表中获取值。我还需要获取图像的URL,但问题是这个图像是通过javascript动态生成的 - 当我通过urllib获取网站内容时,Javascript不会在生成的HTML中运行或显示。

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.

有没有办法让Javascript在通过urllib访问的页面上运行?

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

推荐答案

不,你需要某种JS解释器。可能有Python-Browser集成来帮助解析这种页面。

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

这篇关于Python:用urllib2处理Javascript?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆