I want to extract all the product url from the link "http://www.shopclues.com/diwali-mega-mall/hot-electronics-sale-fs/audio-systems-fs.html" using scrapy in python. Below is the function I'm using to do this:
def parse(self, response):
print("hello");
hxs = HtmlXPathSelector(response)
sites = hxs.select('//div[@id="pagination_contents"]')
items = []
i=3
for site in sites:
item = DmozItem()
item['link'] = site.select('div[2]/div['+str(i)+']/a/@href').extract()
i=int(i)+1;
print i
items.append(item)
return items
The x-path of each product div is: //div[@id="pagination_contents"]/div[2]/div['+str(i)+']/a/@href
But I'm getting only one link and not all the products' url.