How to stop scrapy spider after certain number of requests?

后端 未结 5 640
情书的邮戳
情书的邮戳 2021-02-04 20:01

I am developing an simple scraper to get 9 gag posts and its images but due to some technical difficulties iam unable to stop the scraper and it keeps on scraping

5条回答
  •  长发绾君心
    2021-02-04 20:44

    count is local to the parse() method so it's not preserved between pages. Change all occurences of count to self.count to make it an instance variable of the class and it will persist betwen pages.

提交回复
热议问题