mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Some more http->https
This commit is contained in:
parent
2bb5f7af79
commit
5f8a7c04f7
@ -165,7 +165,7 @@ class Douban(Source):
|
|||||||
cached_cover_url_is_reliable = True
|
cached_cover_url_is_reliable = True
|
||||||
|
|
||||||
DOUBAN_API_KEY = '0bd1672394eb1ebf2374356abec15c3d'
|
DOUBAN_API_KEY = '0bd1672394eb1ebf2374356abec15c3d'
|
||||||
DOUBAN_BOOK_URL = 'http://book.douban.com/subject/%s/'
|
DOUBAN_BOOK_URL = 'https://book.douban.com/subject/%s/'
|
||||||
|
|
||||||
def get_book_url(self, identifiers): # {{{
|
def get_book_url(self, identifiers): # {{{
|
||||||
db = identifiers.get('douban', None)
|
db = identifiers.get('douban', None)
|
||||||
@ -175,9 +175,9 @@ class Douban(Source):
|
|||||||
|
|
||||||
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
|
||||||
SEARCH_URL = 'http://api.douban.com/book/subjects?'
|
SEARCH_URL = 'https://api.douban.com/book/subjects?'
|
||||||
ISBN_URL = 'http://api.douban.com/book/subject/isbn/'
|
ISBN_URL = 'https://api.douban.com/book/subject/isbn/'
|
||||||
SUBJECT_URL = 'http://api.douban.com/book/subject/'
|
SUBJECT_URL = 'https://api.douban.com/book/subject/'
|
||||||
|
|
||||||
q = ''
|
q = ''
|
||||||
t = None
|
t = None
|
||||||
@ -339,6 +339,7 @@ class Douban(Source):
|
|||||||
return None
|
return None
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__': # tests {{{
|
if __name__ == '__main__': # tests {{{
|
||||||
# To run these test use: calibre-debug -e src/calibre/ebooks/metadata/sources/douban.py
|
# To run these test use: calibre-debug -e src/calibre/ebooks/metadata/sources/douban.py
|
||||||
from calibre.ebooks.metadata.sources.test import (test_identify_plugin,
|
from calibre.ebooks.metadata.sources.test import (test_identify_plugin,
|
||||||
@ -360,4 +361,3 @@ if __name__ == '__main__': # tests {{{
|
|||||||
),
|
),
|
||||||
])
|
])
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
|
@ -182,7 +182,7 @@ class Edelweiss(Source):
|
|||||||
|
|
||||||
def _get_book_url(self, sku):
|
def _get_book_url(self, sku):
|
||||||
if sku:
|
if sku:
|
||||||
return 'http://edelweiss.abovethetreeline.com/ProductDetailPage.aspx?sku=%s'%sku
|
return 'https://edelweiss.abovethetreeline.com/ProductDetailPage.aspx?sku=%s'%sku
|
||||||
|
|
||||||
def get_book_url(self, identifiers): # {{{
|
def get_book_url(self, identifiers): # {{{
|
||||||
sku = identifiers.get('edelweiss', None)
|
sku = identifiers.get('edelweiss', None)
|
||||||
@ -202,7 +202,7 @@ class Edelweiss(Source):
|
|||||||
|
|
||||||
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://edelweiss.abovethetreeline.com/Browse.aspx?source=catalog&rg=4187&group=browse&pg=0&'
|
BASE_URL = 'https://edelweiss.abovethetreeline.com/Browse.aspx?source=catalog&rg=4187&group=browse&pg=0&'
|
||||||
params = {
|
params = {
|
||||||
'browseType':'title', 'startIndex':0, 'savecook':1, 'sord':20, 'secSord':20, 'tertSord':20,
|
'browseType':'title', 'startIndex':0, 'savecook':1, 'sord':20, 'secSord':20, 'tertSord':20,
|
||||||
}
|
}
|
||||||
@ -359,6 +359,7 @@ class Edelweiss(Source):
|
|||||||
log.exception('Failed to download cover from:', cached_url)
|
log.exception('Failed to download cover from:', cached_url)
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
from calibre.ebooks.metadata.sources.test import (
|
from calibre.ebooks.metadata.sources.test import (
|
||||||
test_identify_plugin, title_test, authors_test, comments_test, pubdate_test)
|
test_identify_plugin, title_test, authors_test, comments_test, pubdate_test)
|
||||||
|
@ -555,23 +555,23 @@ def urls_from_identifiers(identifiers): # {{{
|
|||||||
isbn = identifiers.get('isbn', None)
|
isbn = identifiers.get('isbn', None)
|
||||||
if isbn:
|
if isbn:
|
||||||
ans.append((isbn, 'isbn', isbn,
|
ans.append((isbn, 'isbn', isbn,
|
||||||
'http://www.worldcat.org/isbn/'+isbn))
|
'https://www.worldcat.org/isbn/'+isbn))
|
||||||
doi = identifiers.get('doi', None)
|
doi = identifiers.get('doi', None)
|
||||||
if doi:
|
if doi:
|
||||||
ans.append(('DOI', 'doi', doi,
|
ans.append(('DOI', 'doi', doi,
|
||||||
'http://dx.doi.org/'+doi))
|
'https://dx.doi.org/'+doi))
|
||||||
arxiv = identifiers.get('arxiv', None)
|
arxiv = identifiers.get('arxiv', None)
|
||||||
if arxiv:
|
if arxiv:
|
||||||
ans.append(('arXiv', 'arxiv', arxiv,
|
ans.append(('arXiv', 'arxiv', arxiv,
|
||||||
'http://arxiv.org/abs/'+arxiv))
|
'https://arxiv.org/abs/'+arxiv))
|
||||||
oclc = identifiers.get('oclc', None)
|
oclc = identifiers.get('oclc', None)
|
||||||
if oclc:
|
if oclc:
|
||||||
ans.append(('OCLC', 'oclc', oclc,
|
ans.append(('OCLC', 'oclc', oclc,
|
||||||
'http://www.worldcat.org/oclc/'+oclc))
|
'https://www.worldcat.org/oclc/'+oclc))
|
||||||
issn = check_issn(identifiers.get('issn', None))
|
issn = check_issn(identifiers.get('issn', None))
|
||||||
if issn:
|
if issn:
|
||||||
ans.append((issn, 'issn', issn,
|
ans.append((issn, 'issn', issn,
|
||||||
'http://www.worldcat.org/issn/'+issn))
|
'https://www.worldcat.org/issn/'+issn))
|
||||||
for k, url in identifiers.iteritems():
|
for k, url in identifiers.iteritems():
|
||||||
if url and re.match(r'ur[il]\d*$', k) is not None:
|
if url and re.match(r'ur[il]\d*$', k) is not None:
|
||||||
url = url[:8].replace('|', ':') + url[8:].replace('|', ',')
|
url = url[:8].replace('|', ':') + url[8:].replace('|', ',')
|
||||||
@ -582,6 +582,7 @@ def urls_from_identifiers(identifiers): # {{{
|
|||||||
return ans
|
return ans
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__': # tests {{{
|
if __name__ == '__main__': # tests {{{
|
||||||
# To run these test use: calibre-debug -e
|
# To run these test use: calibre-debug -e
|
||||||
# src/calibre/ebooks/metadata/sources/identify.py
|
# src/calibre/ebooks/metadata/sources/identify.py
|
||||||
@ -628,4 +629,3 @@ if __name__ == '__main__': # tests {{{
|
|||||||
# test_identify(tests[1:2])
|
# test_identify(tests[1:2])
|
||||||
test_identify(tests)
|
test_identify(tests)
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ from calibre.ebooks.metadata.sources.base import Source, Option
|
|||||||
from calibre.utils.icu import lower
|
from calibre.utils.icu import lower
|
||||||
from calibre.ebooks.metadata.book.base import Metadata
|
from calibre.ebooks.metadata.book.base import Metadata
|
||||||
|
|
||||||
BASE_URL = 'http://isbndb.com/api/books.xml?access_key=%s&page_number=1&results=subjects,authors,texts&'
|
BASE_URL = 'https://isbndb.com/api/books.xml?access_key=%s&page_number=1&results=subjects,authors,texts&'
|
||||||
|
|
||||||
|
|
||||||
class ISBNDB(Source):
|
class ISBNDB(Source):
|
||||||
@ -37,7 +37,7 @@ class ISBNDB(Source):
|
|||||||
config_help_message = ('<p>'+_('To use metadata from isbndb.com you must sign'
|
config_help_message = ('<p>'+_('To use metadata from isbndb.com you must sign'
|
||||||
' up for a free account and get an isbndb key and enter it below.'
|
' up for a free account and get an isbndb key and enter it below.'
|
||||||
' Instructions to get the key are '
|
' Instructions to get the key are '
|
||||||
'<a href="%s">here</a>.')) % 'http://isbndb.com/api/v1/docs/keys'
|
'<a href="%s">here</a>.')) % 'https://isbndb.com/api/v1/docs/keys'
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
Source.__init__(self, *args, **kwargs)
|
Source.__init__(self, *args, **kwargs)
|
||||||
@ -221,6 +221,7 @@ class ISBNDB(Source):
|
|||||||
return candidates
|
return candidates
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
# To run these test use:
|
# To run these test use:
|
||||||
# calibre-debug -e src/calibre/ebooks/metadata/sources/isbndb.py
|
# calibre-debug -e src/calibre/ebooks/metadata/sources/isbndb.py
|
||||||
@ -242,4 +243,3 @@ if __name__ == '__main__':
|
|||||||
[title_test('Flatland', exact=False)]
|
[title_test('Flatland', exact=False)]
|
||||||
),
|
),
|
||||||
])
|
])
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ class OpenLibrary(Source):
|
|||||||
|
|
||||||
capabilities = frozenset(['cover'])
|
capabilities = frozenset(['cover'])
|
||||||
|
|
||||||
OPENLIBRARY = 'http://covers.openlibrary.org/b/isbn/%s-L.jpg?default=false'
|
OPENLIBRARY = 'https://covers.openlibrary.org/b/isbn/%s-L.jpg?default=false'
|
||||||
|
|
||||||
def download_cover(self, log, result_queue, abort,
|
def download_cover(self, log, result_queue, abort,
|
||||||
title=None, authors=None, identifiers={}, timeout=30, get_best_cover=False):
|
title=None, authors=None, identifiers={}, timeout=30, get_best_cover=False):
|
||||||
@ -33,4 +33,3 @@ class OpenLibrary(Source):
|
|||||||
log.error('No cover for ISBN: %r found'%isbn)
|
log.error('No cover for ISBN: %r found'%isbn)
|
||||||
else:
|
else:
|
||||||
log.exception('Failed to download cover for ISBN:', isbn)
|
log.exception('Failed to download cover for ISBN:', isbn)
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ from calibre.ebooks.metadata.book.base import Metadata
|
|||||||
|
|
||||||
ovrdrv_data_cache = {}
|
ovrdrv_data_cache = {}
|
||||||
cache_lock = RLock()
|
cache_lock = RLock()
|
||||||
base_url = 'http://search.overdrive.com/'
|
base_url = 'https://search.overdrive.com/'
|
||||||
|
|
||||||
|
|
||||||
class OverDrive(Source):
|
class OverDrive(Source):
|
||||||
@ -134,11 +134,11 @@ class OverDrive(Source):
|
|||||||
|
|
||||||
def get_base_referer(self): # to be used for passing referrer headers to cover download
|
def get_base_referer(self): # to be used for passing referrer headers to cover download
|
||||||
choices = [
|
choices = [
|
||||||
'http://overdrive.chipublib.org/82DC601D-7DDE-4212-B43A-09D821935B01/10/375/en/',
|
'https://overdrive.chipublib.org/82DC601D-7DDE-4212-B43A-09D821935B01/10/375/en/',
|
||||||
'http://emedia.clevnet.org/9D321DAD-EC0D-490D-BFD8-64AE2C96ECA8/10/241/en/',
|
'https://emedia.clevnet.org/9D321DAD-EC0D-490D-BFD8-64AE2C96ECA8/10/241/en/',
|
||||||
'http://singapore.lib.overdrive.com/F11D55BE-A917-4D63-8111-318E88B29740/10/382/en/',
|
'https://singapore.lib.overdrive.com/F11D55BE-A917-4D63-8111-318E88B29740/10/382/en/',
|
||||||
'http://ebooks.nypl.org/20E48048-A377-4520-BC43-F8729A42A424/10/257/en/',
|
'https://ebooks.nypl.org/20E48048-A377-4520-BC43-F8729A42A424/10/257/en/',
|
||||||
'http://spl.lib.overdrive.com/5875E082-4CB2-4689-9426-8509F354AFEF/10/335/en/'
|
'https://spl.lib.overdrive.com/5875E082-4CB2-4689-9426-8509F354AFEF/10/335/en/'
|
||||||
]
|
]
|
||||||
return choices[random.randint(0, len(choices)-1)]
|
return choices[random.randint(0, len(choices)-1)]
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ class Ozon(Source):
|
|||||||
supports_gzip_transfer_encoding = True
|
supports_gzip_transfer_encoding = True
|
||||||
has_html_comments = True
|
has_html_comments = True
|
||||||
|
|
||||||
ozon_url = 'http://www.ozon.ru'
|
ozon_url = 'https://www.ozon.ru'
|
||||||
|
|
||||||
# match any ISBN10/13. From "Regular Expressions Cookbook"
|
# match any ISBN10/13. From "Regular Expressions Cookbook"
|
||||||
isbnPattern = r'(?:ISBN(?:-1[03])?:? )?(?=[-0-9 ]{17}|' \
|
isbnPattern = r'(?:ISBN(?:-1[03])?:? )?(?=[-0-9 ]{17}|' \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user