Another variant of Amazon cover markup

Seems to be user agent dependent
This commit is contained in:
Kovid Goyal 2016-06-05 10:13:34 +05:30
parent 1c1aba239b
commit 68cc6ae288

View File

@ -605,11 +605,11 @@ class Worker(Thread): # Get details {{{
imgs = root.xpath('//img[(@id="prodImage" or @id="original-main-image" or @id="main-image" or @id="main-image-nonjs") and @src]')
if not imgs:
imgs = root.xpath('//div[@class="main-image-inner-wrapper"]/img[@src]')
if not imgs:
imgs = root.xpath('//div[@id="main-image-container"]//img[@src]')
if not imgs:
imgs = root.xpath('//div[@id="mainImageContainer"]//img[@data-a-dynamic-image]')
imgs = (
root.xpath('//div[@class="main-image-inner-wrapper"]/img[@src]') or
root.xpath('//div[@id="main-image-container" or @id="ebooks-main-image-container"]//img[@src]') or
root.xpath('//div[@id="mainImageContainer"]//img[@data-a-dynamic-image]')
)
for img in imgs:
try:
idata = json.loads(img.get('data-a-dynamic-image'))