【发布时间】:2010-07-29 11:50:46
【问题描述】:
我想解析 Google 搜索并从搜索结果中的每个项目中获取指向 RSS 的链接。 我使用 Scrapy。 我试过这个结构,
...
def parse_second(self, response):
hxs = HtmlXPathSelector(response)
qqq = hxs.select('/html/head/link[@type=application/rss+xml]/@href').extract()
print qqq
item = response.request.meta['item']
if len(qqq) > 0:
item['rss'] = qqq.pop()
else:
item['rss'] = ''
yield item
...
但是 “打印qqq”给我
[]
【问题讨论】:
-
能否包含一个您尝试匹配的 HTML 示例?
标签: python xpath rss parsing scrapy