可以xpath项目2+字段?

时间:2017-10-03 05:15:42

标签: python xpath scrapy projection

有一个由锚元素组成的网页。我想从所有锚元素中选择 text 和属性 href 值。我正在使用scrapy的xpath引擎来做同样的事情。所以我尝试了以下但没有取得多大成功:

response.xpath('//a[position()>1]/(text()|@href)').extract()
response.xpath('//a[position()>1]/text()/@href').extract()

但是这些错误了。

这首先在xpath中可行吗?

Ps:说scrapy的xpath引擎可能不正确 - 我认为它的lxml python包。

0 个答案:

没有答案