wico77
V2EX  ›  问与答

pyquery 无法获取 img 下的 src 属性

  •  
  •   wico77 · Mar 22, 2015 · 3741 views
    This topic created in 4114 days ago, the information mentioned may be changed or developed.

    http://i.imgur.com/TeI2vxg.png

    d=pq(url)
    s=pq('img').attr('src')
    获取不到结果,但img下的其他属性能获得。难道是加密的原因?请问如何获得src属性?

    5 replies    2015-03-22 23:13:15 +08:00
    ericls
        1
    ericls  
       Mar 22, 2015 via Android
    你看这个属性是不是后来加上去的 你看看pq('img').html()
    wico77
        2
    wico77  
    OP
       Mar 22, 2015
    @ericls 加html()出错,我看源码跟查div发现不一样。应该是js生产的吧。这种怎么处理呢
    Tink
        3
    Tink  
    PRO
       Mar 22, 2015
    这是ajax赋进去的吧
    hahasong
        4
    hahasong  
       Mar 22, 2015
    phantomjs
    shoumu
        5
    shoumu  
       Mar 22, 2015
    phantomjs or casperjs
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2888 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 47ms · UTC 09:50 · PVG 17:50 · LAX 02:50 · JFK 05:50
    ♥ Do have faith in what you're doing.