I am new to scrapy and I am trying to scrape the Ikea website webpage. The basic page with the list of locations as given here.
My items.py file is
There is a simple mistake inside the xpath expressions for the item fields. The loop is already going over the a
tags, you don't need to specify a
in the inner xpath expressions. In other words, currently you are searching for a
tags inside the a
tags inside the td
inside tr
. Which obviously results into nothing.
Replace a/text()
with text()
and a/@href
with @href
.
(tested - works for me)
use this....
item['name'] = sel.xpath('//a/text()').extract()
item['link'] = sel.xpath('//a/@href').extract()