rating报错问题

This commit is contained in:
gary.fu 2021-10-30 20:28:50 +08:00
parent fc4335717e
commit 18086a604f
1 changed files with 4 additions and 1 deletions

View File

@ -24,7 +24,10 @@ class Douban(Metadata):
v['publisher'] = r.get('publisher', "")
v['publishedDate'] = r.get('pubdate', "")
v['tags'] = [tag.get('name', '') for tag in r.get('tags', [])]
v['rating'] = float(r['rating'].get('average', '0')) / 2
rating = r['rating'].get('average', '0')
if not rating:
rating = '0'
v['rating'] = float(rating) / 2
if r.get('image'):
v['cover'] = r.get('image')
else: