在 python 中抓取 javascript 呈现 HTML 页面

Scraping javascript rendered HTML page in python

我正在使用 python 抓取网站,但该网站正在使用 javascript 呈现,并且所有链接都来自 javascript。因此,当我使用 request.get(url) 时,它只提供源代码,而不提供使用 javascript 生成的其他链接。有什么方法可以自动抓取这些链接吗?

我也尝试过类似此处描述的方法:Ultimate guide for scraping JavaScript rendered web pages。但是加载速度太慢了。

那么有没有更快的方法,使用 Mechanize、Phantom 或其他一些库? (注意:我已经尝试过使用 PyQ4,但这太慢了 - 我正在寻找更快的解决方案)。

你可以试试 PhantomJs 或 Casperjs

There are more node wrappers written over phantom and casperjs one of the most efficient and scalable is "ghost town"