More http -> https

This commit is contained in:
Kovid Goyal 2017-02-09 14:43:24 +05:30
parent 200964c4be
commit 82b97f2b0e
3 changed files with 13 additions and 14 deletions

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import (unicode_literals, division, absolute_import, print_function) from __future__ import (unicode_literals, division, absolute_import, print_function)
store_version = 2 # Needed for dynamic plugin loading store_version = 3 # Needed for dynamic plugin loading
__license__ = 'GPL 3' __license__ = 'GPL 3'
__copyright__ = '2011, John Schember <john@nachtimwald.com>' __copyright__ = '2011, John Schember <john@nachtimwald.com>'
@ -14,15 +14,14 @@ from calibre.gui2.store.search_result import SearchResult
class ArchiveOrgStore(BasicStoreConfig, OpenSearchOPDSStore): class ArchiveOrgStore(BasicStoreConfig, OpenSearchOPDSStore):
open_search_url = 'http://bookserver.archive.org/catalog/opensearch.xml' open_search_url = 'https://bookserver.archive.org/catalog/opensearch.xml'
web_url = 'http://www.archive.org/details/texts' web_url = 'https://www.archive.org/details/texts'
# http://bookserver.archive.org/catalog/ # https://bookserver.archive.org/catalog/
def search(self, query, max_results=10, timeout=60): def search(self, query, max_results=10, timeout=60):
for s in OpenSearchOPDSStore.search(self, query, max_results, timeout): for s in OpenSearchOPDSStore.search(self, query, max_results, timeout):
s.detail_item = 'http://www.archive.org/details/' + s.detail_item.split(':')[-1] s.detail_item = 'https://www.archive.org/details/' + s.detail_item.split(':')[-1]
s.price = '$0.00' s.price = '$0.00'
s.drm = SearchResult.DRM_UNLOCKED s.drm = SearchResult.DRM_UNLOCKED
yield s yield s

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import (unicode_literals, division, absolute_import, print_function) from __future__ import (unicode_literals, division, absolute_import, print_function)
store_version = 2 # Needed for dynamic plugin loading store_version = 3 # Needed for dynamic plugin loading
__license__ = 'GPL 3' __license__ = 'GPL 3'
__copyright__ = '2011, John Schember <john@nachtimwald.com>' __copyright__ = '2011, John Schember <john@nachtimwald.com>'
@ -25,7 +25,7 @@ from calibre.gui2.store.web_store_dialog import WebStoreDialog
class GoogleBooksStore(BasicStoreConfig, StorePlugin): class GoogleBooksStore(BasicStoreConfig, StorePlugin):
def open(self, parent=None, detail_item=None, external=False): def open(self, parent=None, detail_item=None, external=False):
url = 'http://books.google.com/books' url = 'https://books.google.com/books'
if external or self.config.get('open_external', False): if external or self.config.get('open_external', False):
open_url(QUrl(url_slash_cleaner(detail_item if detail_item else url))) open_url(QUrl(url_slash_cleaner(detail_item if detail_item else url)))
else: else:
@ -35,7 +35,7 @@ class GoogleBooksStore(BasicStoreConfig, StorePlugin):
d.exec_() d.exec_()
def search(self, query, max_results=10, timeout=60): def search(self, query, max_results=10, timeout=60):
url = 'http://www.google.com/search?tbm=bks&q=' + urllib.quote_plus(query) url = 'https://www.google.com/search?tbm=bks&q=' + urllib.quote_plus(query)
br = browser() br = browser()
@ -90,4 +90,3 @@ class GoogleBooksStore(BasicStoreConfig, StorePlugin):
search_result.formats = _('Unknown') search_result.formats = _('Unknown')
return True return True

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import (unicode_literals, division, absolute_import, print_function) from __future__ import (unicode_literals, division, absolute_import, print_function)
store_version = 3 # Needed for dynamic plugin loading store_version = 4 # Needed for dynamic plugin loading
__license__ = 'GPL 3' __license__ = 'GPL 3'
__copyright__ = '2011, John Schember <john@nachtimwald.com>' __copyright__ = '2011, John Schember <john@nachtimwald.com>'
@ -25,7 +25,7 @@ from calibre.gui2.store.web_store_dialog import WebStoreDialog
def search(query, max_results=10, timeout=60): def search(query, max_results=10, timeout=60):
url = 'http://www.smashwords.com/books/search?query=' + urllib2.quote(query) url = 'https://www.smashwords.com/books/search?query=' + urllib2.quote(query)
br = browser() br = browser()
@ -76,7 +76,7 @@ def search(query, max_results=10, timeout=60):
class SmashwordsStore(BasicStoreConfig, StorePlugin): class SmashwordsStore(BasicStoreConfig, StorePlugin):
def open(self, parent=None, detail_item=None, external=False): def open(self, parent=None, detail_item=None, external=False):
url = 'http://www.smashwords.com/' url = 'https://www.smashwords.com/'
aff_id = '?ref=usernone' aff_id = '?ref=usernone'
# Use Kovid's affiliate id 30% of the time. # Use Kovid's affiliate id 30% of the time.
@ -101,7 +101,7 @@ class SmashwordsStore(BasicStoreConfig, StorePlugin):
yield a yield a
def get_details(self, search_result, timeout): def get_details(self, search_result, timeout):
url = 'http://www.smashwords.com/' url = 'https://www.smashwords.com/'
br = browser() br = browser()
with closing(br.open(url + search_result.detail_item, timeout=timeout)) as nf: with closing(br.open(url + search_result.detail_item, timeout=timeout)) as nf:
@ -109,6 +109,7 @@ class SmashwordsStore(BasicStoreConfig, StorePlugin):
search_result.formats = ', '.join(list(set(idata.xpath('//p//abbr//text()')))) search_result.formats = ', '.join(list(set(idata.xpath('//p//abbr//text()'))))
return True return True
if __name__ == '__main__': if __name__ == '__main__':
import sys import sys
for r in search(sys.argv[-1]): for r in search(sys.argv[-1]):