我想通過使用Scrapy抓取下面的鏈接下的網頁。 http://nc.mofcom.gov.cn/channel/qytc2017/list.shtml?p_index=210000 當我試圖抓取下一個頁面, nc.mofcom.gov.cn/channel/qytc2017/list.shtml?p_index=210000 &頁= 2 我是HREF到下一個頁面中使用JavaScript編寫。 首先,我試着用下面的代碼找到所有可能的。蟒蛇 - 使用Scrapy抓取網頁並滿足Javascript
def parse_item(self, response):
for pageNum in range(1, 10):
new_url = response.url + "&page=%d" % pageNum
yield Request(new_url, callback=self.parse_detailpage)
因爲只有子頁面也不會例外;然而,我發現, nc.mofcom.gov.cn/channel/qytc2017/list.shtml?p_index=210000 &頁= 7和NC。 mofcom.gov.cn/channel/qytc2017/list.shtml?p_index=210000 & page = 6共享相同的內容。實際上,我還注意到有些頁面有超過10個子頁面,我無法繼續爬行。任何人都可以給我一些想法嗎?我沒有10個聲望,我可以提供超過1個鏈接和圖像,我真的很抱歉。我真的很感激任何人都可以提供幫助。