Python 使用scrapy获取“下一页”数据
我需要抓取一个商品网站的评论数据,但它的用户数据是分页的。每页的评论是10条,大约有100页。我怎么能把它们都爬出来Python 使用scrapy获取“下一页”数据,python,web-crawler,scrapy-spider,Python,Web Crawler,Scrapy Spider,我需要抓取一个商品网站的评论数据,但它的用户数据是分页的。每页的评论是10条,大约有100页。我怎么能把它们都爬出来 My intention is to use the yield and Request method to crawl the "Next Page" link, and then using the Xpath to extract data. But I can't jump to the next page to extract the data. 以下是关于下一页链
My intention is to use the yield and Request method to crawl the "Next Page" link, and then using the Xpath to extract data. But I can't jump to the next page to extract the data.
以下是关于下一页链接的Html代码:
<div class="xs-pagebar clearfix">
<div class="Pagecon">
<div class="Pagenum">
<a class="pre-page pre-disable">
<a class="pre-page pre-disable">
<span class="curpage">1</span>
<a href="#" onclick="tosubmits(2):return false;">2</a>
<a href="#" onclick="tosubmits(3);return false;">3</a>
<span class="elli">...</span>
<a href="#" class="next-page" onclick="tosubmits('2');return false;">Next Page</a>
<a href="#" onclick="tosubmits('94');return false;">Final Page</a>
</div>
</div>
</div>
href=的确切含义是什么 不幸的是,您将无法使用scrapy执行此操作。href=是一个锚定链接,无处链接,使其看起来像链接。真正发生的是执行的javascript onclick处理程序。您需要有一个执行javascript的方法来为您的用例执行此操作。您可能需要对此进行调查。谢谢您的解释。至于那件事,你知道其他完成这项工作的方法吗?我已经被这个问题困扰了好几天了。正如我说的,你可以使用splinter或者查看chrome开发工具,看看JavaScript在调用什么:非常感谢!通过使用Splinter,我解决了这个问题!Splinter是解决动态网页问题的强大工具,我非常喜欢它!