views:

24

answers:

1

Hello. I want to parse Google search and get links to RSS from each item from the search results. I use Scrapy. I tried this construction,

...
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
...

but "print qqq" gives me

[]
A: 

Found a mistake:

qqq = hxs.select("/html/head/link[@type='application/rss+xml']/@href").extract()

that works

Gennadich