假设你有以下多个Spider:
class Spider(scrapy.spiders.Spider):
name = 'one'
class Spider(scrapy.spiders.Spider):
name = 'two'
在pipeline里判断执行哪个爬虫逻辑:
def process_item(self, item, spider):
if spider.name == 'one':
(执行one的代码逻辑)
elif spider.name == 'two':
(执行two的代码逻辑)
return item