当试图改变响应.url与响应。替换在调用yield请求之前,我得到相同的结果?语法似乎是正确的。在
print(response.url)
response.replace(url='https://techcrunch.com/search/heartbleed#stq=heartbleed&stp=2')
print(response.url)
next = self.driver.find_element(By.XPATH,"//a[@class='page-link next']")
nextpage = next.get_attribute("href")
yield scrapy.Request(url=nextpage, dont_filter=False)
注意:
1我分配了两次网址(obv.不需要,如果它会工作。。。grrr)
2.nextpage是与代码第2行完全相同的url
输出:
^{pr2}$我有一种感觉,这就是为什么我不能去其他链接的原因,因为回应总是停留在同一个网站,而不是跟踪新的链接
我猜replace方法不会执行就地操作,但会返回结果:
所以我会尝试一下:
^{pr2}$相关问题 更多 >
编程相关推荐