Bettwe cover thumbnails for the Amazon store plugin

This commit is contained in:
Kovid Goyal 2011-04-21 19:32:11 -06:00
parent 460cb932af
commit 79f2d3bd4d

View File

@ -154,6 +154,13 @@ class AmazonKindleStore(StorePlugin):
cover_img = data.xpath('//div[@class="productImage"]/a[@href="%s"]/img/@src' % asin_href)
if cover_img:
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()'))
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):
url = 'http://amazon.com/dp/'
br = browser()
with closing(br.open(url + search_result.detail_item, timeout=timeout)) as nf:
idata = html.fromstring(nf.read())
@ -187,4 +194,4 @@ class AmazonKindleStore(StorePlugin):
search_result.drm = SearchResult.DRM_LOCKED
return True