mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix amazon_uk_plugin.py not to report non-kindle items when amazon provides shotgun results.
This commit is contained in:
parent
3cc796e658
commit
ef5a23e199
@ -75,15 +75,19 @@ class AmazonUKKindleStore(AmazonKindleStore):
|
||||
s.title = title.strip()
|
||||
s.price = price.strip()
|
||||
s.detail_item = asin.strip()
|
||||
s.formats = 'Kindle'
|
||||
s.formats = ''
|
||||
|
||||
print('is_shot', is_shot)
|
||||
if is_shot:
|
||||
# Amazon UK does not include the author on the grid layout
|
||||
s.author = ''
|
||||
self.get_details(s, timeout)
|
||||
if s.formats != 'Kindle':
|
||||
continue
|
||||
else:
|
||||
author = ''.join(data.xpath('.//div[@class="productTitle"]/span[@class="ptBrand"]/text()'))
|
||||
s.author = author.split(' by ')[-1].strip()
|
||||
s.formats = 'Kindle'
|
||||
|
||||
yield s
|
||||
|
||||
@ -99,6 +103,10 @@ class AmazonUKKindleStore(AmazonKindleStore):
|
||||
idata = html.fromstring(nf.read())
|
||||
if not search_result.author:
|
||||
search_result.author = ''.join(idata.xpath('//div[@class="buying" and contains(., "Author")]/a/text()'))
|
||||
is_kindle = idata.xpath('boolean(//div[@class="buying"]/h1/span/span[contains(text(), "Kindle Edition")])')
|
||||
if is_kindle:
|
||||
search_result.formats = 'Kindle'
|
||||
print('az uk', is_kindle)
|
||||
if idata.xpath('boolean(//div[@class="content"]//li/b[contains(text(), "' +
|
||||
self.drm_search_text + '")])'):
|
||||
if idata.xpath('boolean(//div[@class="content"]//li[contains(., "' +
|
||||
|
Loading…
x
Reference in New Issue
Block a user