mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Get books: Fix the Kobo store plugin for changes to the website
This commit is contained in:
parent
5b4d4e2cc2
commit
86183fd9f3
@ -1,7 +1,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||||
|
|
||||||
store_version = 7 # Needed for dynamic plugin loading
|
store_version = 8 # 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>'
|
||||||
@ -48,7 +48,7 @@ def search_kobo(query, max_results=10, timeout=60, write_html_to=None):
|
|||||||
else:
|
else:
|
||||||
cover_url = None
|
cover_url = None
|
||||||
|
|
||||||
for p in select('p.title', item):
|
for p in select('h2.title', item):
|
||||||
title = etree.tostring(p, method='text', encoding='unicode').strip()
|
title = etree.tostring(p, method='text', encoding='unicode').strip()
|
||||||
for a in select('a[href]', p):
|
for a in select('a[href]', p):
|
||||||
url = a.get('href')
|
url = a.get('href')
|
||||||
@ -58,9 +58,12 @@ def search_kobo(query, max_results=10, timeout=60, write_html_to=None):
|
|||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
title = None
|
title = None
|
||||||
|
if title:
|
||||||
|
for p in select('p.subtitle', item):
|
||||||
|
title += ' - ' + etree.tostring(p, method='text', encoding='unicode').strip()
|
||||||
|
|
||||||
authors = []
|
authors = []
|
||||||
for a in select('p.contributor-list a.contributor-name', item):
|
for a in select('.contributors a.contributor-name', item):
|
||||||
authors.append(etree.tostring(a, method='text', encoding='unicode').strip())
|
authors.append(etree.tostring(a, method='text', encoding='unicode').strip())
|
||||||
authors = authors_to_string(authors)
|
authors = authors_to_string(authors)
|
||||||
|
|
||||||
@ -127,5 +130,6 @@ class KoboStore(BasicStoreConfig, StorePlugin):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
for result in search_kobo(' '.join(sys.argv[1:]), write_html_to='/t/kobo.html'):
|
for result in search_kobo(' '.join(sys.argv[1:]), write_html_to='/t/kobo.html'):
|
||||||
print(result)
|
print(result)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user