mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Bettwe cover thumbnails for the Amazon store plugin
This commit is contained in:
parent
460cb932af
commit
79f2d3bd4d
@ -154,6 +154,13 @@ class AmazonKindleStore(StorePlugin):
|
|||||||
cover_img = data.xpath('//div[@class="productImage"]/a[@href="%s"]/img/@src' % asin_href)
|
cover_img = data.xpath('//div[@class="productImage"]/a[@href="%s"]/img/@src' % asin_href)
|
||||||
if cover_img:
|
if cover_img:
|
||||||
cover_url = cover_img[0]
|
cover_url = cover_img[0]
|
||||||
|
parts = cover_url.split('/')
|
||||||
|
bn = parts[-1]
|
||||||
|
f, _, ext = bn.rpartition('.')
|
||||||
|
if '_' in f:
|
||||||
|
bn = f.partition('_')[0]+'_SL160_.'+ext
|
||||||
|
parts[-1] = bn
|
||||||
|
cover_url = '/'.join(parts)
|
||||||
|
|
||||||
title = ''.join(data.xpath('div[@class="productTitle"]/a/text()'))
|
title = ''.join(data.xpath('div[@class="productTitle"]/a/text()'))
|
||||||
author = ''.join(data.xpath('div[@class="productTitle"]/span[@class="ptBrand"]/text()'))
|
author = ''.join(data.xpath('div[@class="productTitle"]/span[@class="ptBrand"]/text()'))
|
||||||
@ -174,7 +181,7 @@ class AmazonKindleStore(StorePlugin):
|
|||||||
|
|
||||||
def get_details(self, search_result, timeout):
|
def get_details(self, search_result, timeout):
|
||||||
url = 'http://amazon.com/dp/'
|
url = 'http://amazon.com/dp/'
|
||||||
|
|
||||||
br = browser()
|
br = browser()
|
||||||
with closing(br.open(url + search_result.detail_item, timeout=timeout)) as nf:
|
with closing(br.open(url + search_result.detail_item, timeout=timeout)) as nf:
|
||||||
idata = html.fromstring(nf.read())
|
idata = html.fromstring(nf.read())
|
||||||
@ -187,4 +194,4 @@ class AmazonKindleStore(StorePlugin):
|
|||||||
search_result.drm = SearchResult.DRM_LOCKED
|
search_result.drm = SearchResult.DRM_LOCKED
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user