Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Get class name using Scrapy

I am trying to get the products’ ratings of a webpage. The rating is in <bl-rating>:

enter image description here

To get the title of the product, I did:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

'title':product.css('h2::text').get()

Is there a way to get the rating (4.714…) using a similar technique?

>Solution :

Rating isn’t text node value rather attribute value.So You have to invoke ::attr(rating) instead of ::text to get that value as string/text.

'rating':product.css('bl-rating::attr(rating)').get()
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading