mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
Fix google search not working because of change in website markup
This commit is contained in:
parent
2a66dfead0
commit
7c8672f2ee
@ -20,7 +20,7 @@ from calibre import browser as _browser, prints, random_user_agent
|
|||||||
from calibre.utils.monotonic import monotonic
|
from calibre.utils.monotonic import monotonic
|
||||||
from calibre.utils.random_ua import accept_header_for_ua
|
from calibre.utils.random_ua import accept_header_for_ua
|
||||||
|
|
||||||
current_version = (1, 0, 4)
|
current_version = (1, 0, 5)
|
||||||
minimum_calibre_version = (2, 80, 0)
|
minimum_calibre_version = (2, 80, 0)
|
||||||
|
|
||||||
|
|
||||||
@ -235,7 +235,7 @@ def google_search(terms, site=None, br=None, log=prints, safe_search=False, dump
|
|||||||
ans = []
|
ans = []
|
||||||
for div in root.xpath('//*[@id="search"]//*[@id="rso"]//*[@class="g"]'):
|
for div in root.xpath('//*[@id="search"]//*[@id="rso"]//*[@class="g"]'):
|
||||||
try:
|
try:
|
||||||
a = div.xpath('descendant::div[@class="r"]/a[@href]')[0]
|
a = div.xpath('descendant::div[@class="rc"]//a[@href]')[0]
|
||||||
except IndexError:
|
except IndexError:
|
||||||
log('Ignoring div with no descendant')
|
log('Ignoring div with no descendant')
|
||||||
continue
|
continue
|
||||||
|
Loading…
x
Reference in New Issue
Block a user