V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
xiaoyu9527
V2EX  ›  问与答

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

  •  
  •   xiaoyu9527 · 2017-05-30 10:10:16 +08:00 · 2161 次点击
    这是一个创建于 2544 天前的主题,其中的信息可能已经有所发展或是发生改变。

    <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
       2017-05-30 10:16:13 +08:00
    找到原因了。

    原来是变量被覆盖了
    esile
        2
    esile  
       2017-05-30 14:26:46 +08:00 via iPhone
    lz 一看就是干大事的人
    xiaoyu9527
        3
    xiaoyu9527  
    OP
       2017-05-30 14:29:41 +08:00
    @esile 瞎说什么大实话
    duola
        4
    duola  
       2017-05-30 15:25:47 +08:00
    楼主注意身体。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   6087 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 02:52 · PVG 10:52 · LAX 19:52 · JFK 22:52
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.