我使用以下代码遍历网站的页面。我向start_urls
添加了一个网址。它调用parse()
函数来更改response.css()
所引用的网站。是否可以在不调用parse()
函数的情况下进行更改?谢谢
def parse(self, response):
next_url = self.website + response.css("div.results-paging__next a::attr(href)").extract_first()
self.file.write(next_url + "\n")
yield scrapy.Request(url = next_url, callback = self.parse)