diff --git a/src/douban.py b/src/douban.py index b6bde79..d038ffe 100644 --- a/src/douban.py +++ b/src/douban.py @@ -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: