xiaoyu9527
V2EX  ›  问与答

又有新的 scrpay 问题 为啥抓取出来的图片竟然还是 int 类型呢?

  •  
  •   xiaoyu9527 · May 30, 2017 · 2619 views
    This topic created in 3362 days ago, the information mentioned may be changed or developed.

    <Element 'text'="" at="" 0x7f1852456818=""> 图片 https://img.aitaotu.cc:8089/Pics/2017/0527/11/01.jpg 2017-05-30 10:09:00 [scrapy.core.scraper] ERROR: Spider error processing <GET <a="" href="https://www.aitaotu.com/guonei/31595.html" rel="nofollow">https://www.aitaotu.com/guonei/31595.html> (referer: https://www.aitaotu.com/guonei/list_1.html) Traceback (most recent call last): File "/usr/lib64/python3.6/site-packages/twisted/internet/defer.py", line 653, in _runCallbacks current.result = callback(current.result, *args, **kw) File "/root/aitaotu/aitaotu/spiders/att.py", line 85, in parse_item l.add_value('image_url', img, Identity()) AttributeError: 'int' object has no attribute 'add_value'

    奇怪了。

    我明明另外的规则这么抓的都没问题。 为啥这套抓出来就是 int 呢

    xiaoyu9527
        1
    xiaoyu9527  
    OP
       May 30, 2017
    找到原因了。

    原来是变量被覆盖了
    esile
        2
    esile  
       May 30, 2017 via iPhone
    lz 一看就是干大事的人
    xiaoyu9527
        3
    xiaoyu9527  
    OP
       May 30, 2017
    @esile 瞎说什么大实话
    duola
        4
    duola  
       May 30, 2017
    楼主注意身体。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   934 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: f75fff0a · 28ms · UTC 20:12 · PVG 04:12 · LAX 13:12 · JFK 16:12
    ♥ Do have faith in what you're doing.