我正在关注 youtube 视频https://youtu.be/s4jtkzHhLzY并且已经到了 13:45,此时创作者正在运行他的蜘蛛。我完全按照教程进行操作,但我的代码拒绝运行。这是我的实际代码。我也进口了scrapy。谁能帮我弄清楚为什么scrap拒绝承认我的蜘蛛?该文件位于正确的“蜘蛛”文件中。我很困惑。
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'],
}