Amazon metadata download: Fix download of ratings not working from amazon.co.jp

This commit is contained in:
Kovid Goyal 2020-06-21 10:01:29 +05:30
parent 1f6072c886
commit fe6e4e59ea
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -299,6 +299,7 @@ class Worker(Thread): # Get details {{{
self.ratings_pat = re.compile(
r'([0-9.,]+) ?(out of|von|van|su|étoiles sur|つ星のうち|de un máximo de|de) ([\d\.]+)( (stars|Sternen|stelle|estrellas|estrelas|sterren)){0,1}')
self.ratings_pat_cn = re.compile('平均([0-9.]+)')
self.ratings_pat_jp = re.compile(r'\d+つ星のうち([\d\.]+)')
lm = {
'eng': ('English', 'Englisch', 'Engels'),
@ -575,6 +576,10 @@ class Worker(Thread): # Get details {{{
m = self.ratings_pat_cn.match(t)
if m is not None:
return float(m.group(1))
elif self.domain == 'jp':
m = self.ratings_pat_jp.match(t)
if m is not None:
return float(m.group(1))
else:
ans = parse_ratings_text(t)
if ans is not None: