@classmethod def from_crawler(cls, crawler): ' 这个方法是Scrapy用来创建你的爬虫的。' s = cls() crawler.signals.connect(s.spider_opened, signal=signals.spider_opened) return s

def process_spider_input(self, response, spider):
    ' 对每个通过爬虫中间件进入爬虫的响应进行处理。'

    ' 应该返回None或引发异常。'
    return None

def process_spider_output(self, response, result, spider):
    ' 在爬虫处理完响应后,调用返回的结果。'

    ' 必须返回可迭代的请求或item对象。'
    for i in result:
        yield i

原文地址: https://www.cveoy.top/t/topic/o3fL 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录