No72:Scrapy多个spider时指定pipeline
1、在pipeline里判断爬虫
- settings.py
ITEM_PIPELINES = { |
- OneSpider.py
class OneSpider(scrapy.spiders.Spider): |
- TwoSpider.py
class TwoSpider(scrapy.spiders.Spider): |
- pipelines.py
class MyPipeline(object): |
2、在爬虫里设置pipeline(scrapy版本必须是1.1以上)
- settings.py
ITEM_PIPELINES = { |
- OneSpider.py
class OneSpider(scrapy.Spider): |
- TwoSpider.py
class TwoSpider(scrapy.Spider): |
- pipelines.py
class OneSpiderPipeline(object): |
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 新码农!
评论