In Scrapy can't save file in terminal error "crawl: error: running 'scrapy crawl' with more than one spider is not supported"

import scrapy


class WhiskeySpider(scrapy.Spider):
    name = 'whisky'
    start_urls = ['https://www.whiskyshop.com/scotch-whisky/all?item_availability=In+Stock']

    def parse(self, response, **kwargs):
        for products in response.css('div.product-item-info'):
            try:
                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'],
                }
            except:
                yield {
                    'name': products.css('a.product-item-link::text').get(),
                    'price': 'sold out',
                    'link': products.css('a.product-item-link').attrib['href'],
                }

        next_page = response.css('a.action.next').attrib['href']
        if next_page is not None:
            yield response.follow(next_page, callback=self.parse)

In Terminal

(venv) PS D:\pythonProject7\whiskyscraper> scrapy crawl whisky -0 whisky.json 2022-10-05 20:38:44 [scrapy.utils.log] INFO: Scrapy 2.6.3 started (bot: whiskyscraper) 2022-10-05 20:38:44 [scrapy.utils.log] INFO: Versions: lxml 4.9.1.0, libxml2 2.9.12, cssselect 1.1.0, parsel 1.6.0, w3lib 2.0.1, Twisted 22.8.0, Python 3.10.4 (tags/v3.10.4:9d38120, Mar 23 2022, 23:13:41) [MSC v.1929 64 bit (AMD64)], pyOpenSSL 22.1.0 (OpenSSL 3.0.5 5 Jul 2022), cryptography 38.0.1, Plat form Windows-10-10.0.19044-SP0 Usage

scrapy crawl [options] crawl: error: running 'scrapy crawl' with more than one spider is not supported

HOW to fix it?

I just to start learn do not judge strictly!


Ответы (0 шт):