Amazon metadata download: Workaround for change in Amazon website causing some books to have incorrect ratings downloaded

This commit is contained in:
Kovid Goyal 2011-11-06 20:11:30 +05:30
parent 8aaa1d1b13
commit 1ce331c2aa

View File

@ -341,11 +341,11 @@ class Worker(Thread): # Get details {{{
return authors return authors
def parse_rating(self, root): def parse_rating(self, root):
ratings = root.xpath('//div[@class="jumpBar"]/descendant::span[@class="asinReviewsSummary"]') ratings = root.xpath('//div[@class="jumpBar"]/descendant::span[contains(@class,"asinReviewsSummary")]')
if not ratings: if not ratings:
ratings = root.xpath('//div[@class="buying"]/descendant::span[@class="asinReviewsSummary"]') ratings = root.xpath('//div[@class="buying"]/descendant::span[contains(@class,"asinReviewsSummary")]')
if not ratings: if not ratings:
ratings = root.xpath('//span[@class="crAvgStars"]/descendant::span[@class="asinReviewsSummary"]') ratings = root.xpath('//span[@class="crAvgStars"]/descendant::span[contains(@class,"asinReviewsSummary")]')
if ratings: if ratings:
for elem in ratings[0].xpath('descendant::*[@title]'): for elem in ratings[0].xpath('descendant::*[@title]'):
t = elem.get('title').strip() t = elem.get('title').strip()