mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Same optimization for google books
This commit is contained in:
parent
6333859f09
commit
4fb414f95b
@ -165,19 +165,19 @@ class GoogleBooks(Source):
|
|||||||
supports_gzip_transfer_encoding = True
|
supports_gzip_transfer_encoding = True
|
||||||
cached_cover_url_is_reliable = False
|
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'])
|
DUMMY_IMAGE_MD5 = frozenset(['0de4383ebad0adad5eeb8975cd796657'])
|
||||||
|
|
||||||
def get_book_url(self, identifiers): # {{{
|
def get_book_url(self, identifiers): # {{{
|
||||||
goog = identifiers.get('google', None)
|
goog = identifiers.get('google', None)
|
||||||
if goog is not 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={}): # {{{
|
def create_query(self, log, title=None, authors=None, identifiers={}): # {{{
|
||||||
from urllib import urlencode
|
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))
|
isbn = check_isbn(identifiers.get('isbn', None))
|
||||||
q = ''
|
q = ''
|
||||||
if isbn is not None:
|
if isbn is not None:
|
||||||
@ -336,7 +336,7 @@ if __name__ == '__main__': # tests {{{
|
|||||||
{'identifiers':{'isbn': '0743273567'}, 'title':'Great Gatsby',
|
{'identifiers':{'isbn': '0743273567'}, 'title':'Great Gatsby',
|
||||||
'authors':['Fitzgerald']},
|
'authors':['Fitzgerald']},
|
||||||
[title_test('The great gatsby', exact=True),
|
[title_test('The great gatsby', exact=True),
|
||||||
authors_test(['Francis Scott Fitzgerald'])]
|
authors_test(['F. Scott Fitzgerald'])]
|
||||||
),
|
),
|
||||||
|
|
||||||
(
|
(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user