better cover link

This commit is contained in:
j 2016-01-09 19:39:01 +05:30
parent 0f34468963
commit 5f2d20b286

View file

@ -47,6 +47,7 @@ def info(key, value):
print('unknown %s: %s [%s]' % (key, value, r))
return {}
_data = r['items'][0]['volumeInfo']
_id = r['items'][0]['id']
data = {}
for key in [
'authors',
@ -66,7 +67,9 @@ def info(key, value):
if 'subtitle' in _data and _data['subtitle'].strip():
data['title'] = '{title}: {subtitle}'.format(**_data)
if r['items'][0]['accessInfo']['viewability'] != 'NO_PAGES':
data['cover'] = 'https://books.google.com/books?id=%s&pg=PP1&img=1&zoom=0&hl=en' % r['items'][0]['id']
#data['cover'] = 'https://books.google.com/books?id=%s&pg=PP1&img=1&zoom=0&hl=en' % _id
data['cover'] = 'https://books.google.com/books/content/images/frontcover/%s?fife=w600-rw' % _id
elif 'imageLinks' in _data:
for size in ('extraLarge', 'large', 'medium', 'small', 'thumbnail', 'smallThumbnail'):
if size in _data['imageLinks']: