def rating(self): """The rating of the product normalised to 1.0 """ for li in self.soup.find_all('li', class_='rating'): # get the second string string = next(li.stripped_strings).lower() if 'overall:' not in string: continue img = li.find('img') rating = unicode(img['title']) return process_rating(rating)
def rating(self): rating_tag = self.soup.find('img', title=re.compile(r'out of \d stars')) return process_rating(rating_tag.attrs['title'])
def rating(self): rating = self.soup.find("i", class_=re.compile("review-rating")) if rating: return process_rating(rating.text)