Reputation: 123
I want to scrape information from multiple urls. I use the following code but it doesn't work. May someone please points me to where I have gone wrong?
import scrapy
class spider1(scrapy.Spider):
name = "spider1"
domain = "http://www.amazon.com/dp/"
ASIN = ['B01LA6171I', 'B00OUKHTLO','B00B7LUVZK']
def start_request(self):
for i in ASIN:
yield scrapy.Request(url=domain+i,callback = self.parse)
def parse(self, response):
title =response.css("span#productTitle::text").extract_first().strip()
ASIN_ext = response.xpath("//input[@name='ASIN']/@value").extract_first()
data = {"ASIN":ASIN_ext,"title":title,}
yield data
Upvotes: 0
Views: 3745
Reputation: 388
You just need to add an 's' to the first function
def start_requests(self):
Subtle difference, but Scrapy looks for that specific function so it has to match perfectly.
Upvotes: 6