mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix for empty list error triggered by ASIN search
This commit is contained in:
parent
ef6fd9cf42
commit
aa5420f470
@ -230,7 +230,11 @@ def google_search(terms, site=None, br=None, log=prints, safe_search=False, dump
|
||||
root = query(br, url, 'google', dump_raw, timeout=timeout)
|
||||
ans = []
|
||||
for div in root.xpath('//*[@id="search"]//*[@id="rso"]//*[@class="g"]'):
|
||||
a = div.xpath('descendant::h3[@class="r"]/a[@href]')[0]
|
||||
try:
|
||||
a = div.xpath('descendant::h3[@class="r"]/a[@href]')[0]
|
||||
except IndexError:
|
||||
log('Ignoring div with no descendant')
|
||||
continue
|
||||
title = tostring(a)
|
||||
try:
|
||||
c = div.xpath('descendant::div[@class="s"]//a[@class="fl"]')[0]
|
||||
|
Loading…
x
Reference in New Issue
Block a user