I am trying to scrape rating off of trustpilot.com.
Is it possible to extract a class name using scrapy? I am trying to scrape a rating which is made up of five indi
You could use a combination of both somewhere in your code:
import re classes = response.css('.star-rating').xpath("@class").extract() for cls in classes: match = re.search(r'\bcount-\d+\b', cls) if match: print("Class = {}".format(match.group(0))