3

我想抓取一个有多个页面的网站,当点击一个页码时,它是动态加载的。如何屏幕抓取它?

即,由于 url 不存在为 href 或如何爬到其他页面?

如果有人在这方面帮助我,那就太好了。

PS:点击不同页面时,URL保持不变。

4

6 回答 6

2

您还应该考虑Ghost.py,因为它允许您运行任意 javascript 命令、填写表格并非常快速地进行快照。

于 2013-01-29T07:35:24.310 回答
1

如果您使用的是谷歌浏览器,您可以检查 network->headers 开发者工具中动态调用的 url

因此,基于此,您可以确定它是请求GET还是POST请求。

如果是GET请求,您可以直接从 url 中找到参数。

如果是POST请求,您可以从 开发人员工具form data中找到参数。network->headers

于 2013-01-24T14:06:06.490 回答
0

由于这篇文章被标记为 python 和 web-crawler,所以不得不提到 Beautiful Soup:http ://www.crummy.com/software/BeautifulSoup/

此处的文档:http ://www.crummy.com/software/BeautifulSoup/bs3/download/2.x/documentation.html

于 2013-01-24T15:04:10.270 回答
0

You could look for the data you want in the javascript code instead of the HTML. This is usually a pain but you can do fun things with regular expressions.

Alternatively, some of the browser testing libraries like splinter work by loading the page up in an actual browser like firefox or chrome before scraping. One of those would work if you are running this on a machine with a browser installed.

于 2013-01-24T14:02:25.907 回答
0

如果你不介意使用 gevent。GRobot是另一个不错的选择。

于 2013-05-15T20:33:20.897 回答
0

你不能轻易做到这一点,因为它是一个 ajax 分页(即使使用mechanize)。相反,打开页面的源文件并尝试知道用于ajax分页的url请求是什么。然后,您可以创建一个假请求,并以您自己的方式处理返回的数据

于 2013-01-25T04:58:39.540 回答