神箭手云爬虫如何爬取相同标签或多个一个标签,最后一个标签

admin 2017年3月25日15:34:35系统文档评论2,256 次浏览阅读模式

神箭手云爬虫如何爬取相同标签或多个一个标签,最后一个标签

由于神箭手云爬虫使用的xpath,如果当前class下存在多个相同标签,则可使用[]列表来处理,

如上图

<div class="light-post-meta">

<span>作者: <a href="123" title="123">123</a></span>

<span>日期: <a href="http://1" title="17:19">2016-06-23</a></span>

<span class="post-category">分类: <a href="123213" rel="category tag">123闻</a></span>

<span class="post-comments"><a href="h123">暂无评论</a></span>

</div>

即是:

//div[contains(@class,'light-post-meta')]/span[1]/a

//div[contains(@class,'light-post-meta')]/span[2]/a

如果多个标签,要取最后一个标签,则

使用 元素[last()],如:p[last()]/**

相关文章
weinxin
我的微信
微信扫一扫
admin
  • 本文由 发表于 2017年3月25日15:34:35
  • 转载请务必保留本文链接:https://anyun.org/a/jishuguanzhu/xitongwendang/2017/0325/8625.html

发表评论

匿名网友 填写信息

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: