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

scrapy xpath 问题

  •  
  •   yangjiaronga · 2017 年 2 月 7 日 · 1700 次点击
    这是一个创建于 3271 天前的主题,其中的信息可能已经有所发展或是发生改变。
    <tr>
    <td style="vertical-align:top;">Copper, Cu&nbsp;</td>
    <td class="dataCell" style="vertical-align:top;"><= 0.03 %<span class="dataCondition"></span></td>
    <td class="dataCell" style="vertical-align:top;"><= 0.03 %<span class="dataCondition"></span></td>
    <td class="dataComment" style="vertical-align:top;"></td>
    </tr>

    **response.xpath('/tr').extract()
    只能获取到**

    <tr>
    <td style="vertical-align:top;">Copper, Cu&nbsp;</td>
    <td class="dataCell" style="vertical-align:top;"></td>
    <td class="dataCell" style="vertical-align:top;"></td>
    <td class="dataComment" style="vertical-align:top;"></td>
    </tr>

    <= 0.03 % 和 <span></span>消失不见,为什么呢?
    leavic
        1
    leavic  
       2017 年 2 月 7 日 via iPhone
    确定你看的网页源码是关闭了 javascript 状态下的
    关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   Solana   ·   5554 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 07:07 · PVG 15:07 · LAX 23:07 · JFK 02:07
    ♥ Do have faith in what you're doing.