Python Scrapy: Convert relative paths to absolute paths

前端 未结 5 1362
离开以前
离开以前 2020-11-30 06:12

I have amended the code based on solutions offered below by the great folks here; I get the error shown below the code here.

from scrapy.spider import BaseSp         


        
5条回答
  •  渐次进展
    2020-11-30 06:41

    From Scrapy docs:

    def parse(self, response):
        # ... code ommited
        next_page = response.urljoin(next_page)
        yield scrapy.Request(next_page, self.parse)
    

    that is, response object has a method to do exactly this.

提交回复
热议问题