From 86183fd9f3bf11def0e249f57a060a09220a3d11 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 3 Jun 2021 09:23:59 +0530 Subject: [PATCH] Get books: Fix the Kobo store plugin for changes to the website --- src/calibre/gui2/store/stores/kobo_plugin.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/calibre/gui2/store/stores/kobo_plugin.py b/src/calibre/gui2/store/stores/kobo_plugin.py index f3617e8527..ff922a9c06 100644 --- a/src/calibre/gui2/store/stores/kobo_plugin.py +++ b/src/calibre/gui2/store/stores/kobo_plugin.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- 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' __copyright__ = '2011, John Schember ' @@ -48,7 +48,7 @@ def search_kobo(query, max_results=10, timeout=60, write_html_to=None): else: 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() for a in select('a[href]', p): url = a.get('href') @@ -58,9 +58,12 @@ def search_kobo(query, max_results=10, timeout=60, write_html_to=None): break else: title = None + if title: + for p in select('p.subtitle', item): + title += ' - ' + etree.tostring(p, method='text', encoding='unicode').strip() 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 = authors_to_string(authors) @@ -127,5 +130,6 @@ class KoboStore(BasicStoreConfig, StorePlugin): if __name__ == '__main__': import sys + for result in search_kobo(' '.join(sys.argv[1:]), write_html_to='/t/kobo.html'): print(result)