Same optimization for google books

This commit is contained in:
Kovid Goyal 2016-08-28 14:45:27 +05:30
parent 6333859f09
commit 4fb414f95b

View File

@ -165,19 +165,19 @@ class GoogleBooks(Source):
supports_gzip_transfer_encoding = True
cached_cover_url_is_reliable = False
GOOGLE_COVER = 'http://books.google.com/books?id=%s&printsec=frontcover&img=1'
GOOGLE_COVER = 'https://books.google.com/books?id=%s&printsec=frontcover&img=1'
DUMMY_IMAGE_MD5 = frozenset(['0de4383ebad0adad5eeb8975cd796657'])
def get_book_url(self, identifiers): # {{{
goog = identifiers.get('google', None)
if goog is not None:
return ('google', goog, 'http://books.google.com/books?id=%s'%goog)
return ('google', goog, 'https://books.google.com/books?id=%s'%goog)
# }}}
def create_query(self, log, title=None, authors=None, identifiers={}): # {{{
from urllib import urlencode
BASE_URL = 'http://books.google.com/books/feeds/volumes?'
BASE_URL = 'https://books.google.com/books/feeds/volumes?'
isbn = check_isbn(identifiers.get('isbn', None))
q = ''
if isbn is not None:
@ -336,7 +336,7 @@ if __name__ == '__main__': # tests {{{
{'identifiers':{'isbn': '0743273567'}, 'title':'Great Gatsby',
'authors':['Fitzgerald']},
[title_test('The great gatsby', exact=True),
authors_test(['Francis Scott Fitzgerald'])]
authors_test(['F. Scott Fitzgerald'])]
),
(