I get an empty file every time I run a spider using Scrapy to get a Json or csv file

Viewed 38

this is my code:

import scrapy
class shopjimmyspider(scrapy.Spider):
    name = "shopjimmy"

    start_urls = ['https://www.shopjimmy.com/categories/tv-parts/boards/t-con-boards.html']

    def parse(self, response):
        for products in response.css('article.card.card--cart-disabled'):
            yield {
                'description': products.css('article.card.card--cart-disabled a::text')[3].get(),
                'price': products.css('span.price.price--withoutTax.price-primary::text')[0].get(),
                'stock': products.css('div.card-stock.card-stock--inStock::text')[0].get(),
                'link': products.css('article.card.card--cart-disabled a::attr(href)')[3].get(),
            }

i need to crawl the website and get the data output into csv or json

1 Answers

I used the whole element wrapper which is the tag above (article.card.card--cart-disabled) I got the data i want

Related