Issue
I am following the youtube video https://youtu.be/s4jtkzHhLzY and have reached 13:45, when the creator runs his spider. I have followed the tutorial precisely, yet my code refuses to run. This is my actual code. I imported scrapy too as well. Can anyone help me figure out why scrap refuses to acknowledge my spider? The file is in the correct 'spider' file. I am so confused rn.
import scrapy
from scrapy.spiders import Spider
class WhiskeySpider(scrapy.Spider):
spider_name = 'whiskey'
start_urls = ['https://www.whiskyshop.com/single-malt-scotch-whisky']
def parse(self, response):
for products in response.css('div.product-item-info'):
yield {
'name' : products.css('a.product-item-link::text').get(),
'price' : products.css('span.price::text').get().replace('£',''),
'link' : products.css('a.product-item-link').attrib['href'],
}
Solution
spider_name = 'whiskey'
should be name = 'whiskey'
Answered By - SuperUser
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.