Skip to content
Advertisement

Scrapy : Crawled 0 pages (at 0 pages/min), scraped 0 items

I’m new to python and I’m trying to scrape a html with a scrapy spider but the response returns nothing. Wondering what’s wrong here? Thanks for any help in advance.

The url:

https://directory.lubesngreases.com/LngMain/includes/themes/MuraBootstrap3/remote/api/?fn=searchcompany&name&query&STATE&brand&COUNTRY&query2&mode=advanced&filters=%7B%7D&page=1&datatype=html

My spider:

JavaScript

Output:

JavaScript

Advertisement

Answer

I added print('url:', response.url) in parse() and I see it runs this function.

First problem is that you use CSS in wrong way.

This div has two classes company-item and row and you have to use two dots (without space)

JavaScript

You use div.company-item row which means <div class="company-item"> <row>


Second problem is that you use variable product which doesn’t exist.

It has to be company.css() instead of product.css()


Third problem is that it has to be span, not class in company.css() or you should skip class

JavaScript

but this gives HTML and you need pseudo-selector ::text to get only text from HTML

JavaScript

JavaScript
User contributions licensed under: CC BY-SA
12 People found this is helpful
Advertisement