带有 JavaScript 的编程 Python 浏览器 [英] Programmatic Python Browser with JavaScript
问题描述
我想对使用 JavaScript 的网站进行屏幕抓取.
I want to screen-scrape a web-site that uses JavaScript.
有 mechanize,这是 Python 的编程网络浏览器.但是,它(可以理解)不会解释 javascript.是否有任何适用于 Python 的程序化浏览器?如果没有,我可以使用 Python 中的任何 JavaScript 实现来尝试创建一个吗?
There is mechanize, the programmatic web browser for Python. However, it (understandably) doesn't interpret javascript. Is there any programmatic browser for Python which does? If not, is there any JavaScript implementation in Python that I could use to attempt to create one?
推荐答案
你最好使用像 Selenium 使用 Web 浏览器自动抓取,以便 JS 执行并呈现页面,就像对真实用户一样.
You might be better off using a tool like Selenium to automate the scraping using a web browser, so the JS executes and the page renders just like it would for a real user.
这篇关于带有 JavaScript 的编程 Python 浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!