mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #1698943 [get books search will not find mature content in smashwords](https://bugs.launchpad.net/calibre/+bug/1698943)
This commit is contained in:
parent
f427882d67
commit
65130a8cd2
@ -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 = 4 # Needed for dynamic plugin loading
|
store_version = 5 # 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>'
|
||||||
@ -28,6 +28,10 @@ def search(query, max_results=10, timeout=60):
|
|||||||
url = 'https://www.smashwords.com/books/search?query=' + urllib2.quote(query)
|
url = 'https://www.smashwords.com/books/search?query=' + urllib2.quote(query)
|
||||||
|
|
||||||
br = browser()
|
br = browser()
|
||||||
|
try:
|
||||||
|
br.set_simple_cookie('adultOff', 'erotica', '.smashwords.com', path='/')
|
||||||
|
except AttributeError:
|
||||||
|
pass # old version of mechanize
|
||||||
|
|
||||||
counter = max_results
|
counter = max_results
|
||||||
with closing(br.open(url, timeout=timeout)) as f:
|
with closing(br.open(url, timeout=timeout)) as f:
|
||||||
@ -112,5 +116,5 @@ class SmashwordsStore(BasicStoreConfig, StorePlugin):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
import sys
|
import sys
|
||||||
for r in search(sys.argv[-1]):
|
for r in search(' '.join(sys.argv[1:])):
|
||||||
print(r)
|
print(r)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user