start_urls = ['https://image.jpg']
def start_requests(self):
for url in self.start_urls:
request = scrapy.Request(url,callback=self.parse)
yield request
def parse(self, response):
item = GetImgsItem()
# print(response.url)
item['image_urls'] = response.url
yield item
My spider can now download the image from start_urls but the request was sent twice to give one image. How should I turn it to download in start_requests ?
Question 2: I created two spiders (spider A , spider B) in my project. In spider A, I have a specific pipeline class to deal the downloaded items. It works well now.
But later when I used spider B, it also used the same pipeline class of spider A. How should I set pipeline class so that it is exclusive for spider A to use ?