推荐学习书目
› Learn Python the Hard Way
Python Sites
› PyPI - Python Package Index
› http://diveintopython.org/toc/index.html
› Pocoo
值得关注的项目
› PyPy
› Celery
› Jinja2
› Read the Docs
› gevent
› pyenv
› virtualenv
› Stackless Python
› Beautiful Soup
› 结巴中文分词
› Green Unicorn
› Sentry
› Shovel
› Pyflakes
› pytest
Python 编程
› pep8 Checker
Styles
› PEP 8
› Google Python Style Guide
› Code Style from The Hitchhiker's Guide
bestehen
V2EX  ›  Python

Python scrapy 的多爬虫问题

  •  
  •   bestehen · Jun 20, 2018 · 2947 views
    This topic created in 3036 days ago, the information mentioned may be changed or developed.
    请问 scrapy 多个 spider 的时候 如何知道 那个对应那个 field () 如何对应 pipeline 入库呢
    1 replies  •  2018-06-26 07:14:00 +08:00
    lt921002191
        1
    lt921002191  
       Jun 26, 2018 via Android
    比如你 A ~ spider 要 A_item,就在 A ~ spider 里面生成一个 A_item,然后在 pipeline 里面加个 if isinstance(item,A ~ item)执行这个 spider 之下的操作,B ~ spider 方法同上
    也可以在 pipeline 直接判断是哪个 spider,比如 if spider.name=A ~ spider 执行哪个操作,B ~ spider 执行什么操作
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   3548 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 38ms · UTC 10:48 · PVG 18:48 · LAX 03:48 · JFK 06:48
    ♥ Do have faith in what you're doing.