From f9c1c6e7f05c1a724882bae7e39f68d9fa97f99f Mon Sep 17 00:00:00 2001 From: John Schember Date: Sat, 27 Aug 2011 15:41:56 -0400 Subject: [PATCH] Store: Fix Google Books plugin. --- src/calibre/gui2/store/stores/google_books_plugin.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/calibre/gui2/store/stores/google_books_plugin.py b/src/calibre/gui2/store/stores/google_books_plugin.py index 4819509c3f..a04ea45ebb 100644 --- a/src/calibre/gui2/store/stores/google_books_plugin.py +++ b/src/calibre/gui2/store/stores/google_books_plugin.py @@ -68,8 +68,8 @@ class GoogleBooksStore(BasicStoreConfig, StorePlugin): continue title = ''.join(data.xpath('.//h3/a//text()')) - authors = data.xpath('.//span[@class="gl"]//a//text()') - if authors[-1].strip().lower() in ('preview', 'read'): + authors = data.xpath('.//span[@class="f"]//a//text()') + if authors and authors[-1].strip().lower() in ('preview', 'read'): authors = authors[:-1] else: continue @@ -98,6 +98,8 @@ class GoogleBooksStore(BasicStoreConfig, StorePlugin): if not price.strip(): price = ''.join(doc.xpath('//div[@class="buy-container"]/a/text()')) price = price.split('-')[-1] + if 'view' in price.lower(): + price = 'Unknown' # No price set for this book. if not price.strip(): price = '$0.00'