mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Metadata download: Update plugin to get covers from google image search to handle changes to the google website. Fixes #1254973 [Google Images metadata search yields no results](https://bugs.launchpad.net/calibre/+bug/1254973)
This commit is contained in:
parent
6f07157a6c
commit
3bc7e7d943
@ -59,14 +59,16 @@ class GoogleImages(Source):
|
||||
|
||||
return []
|
||||
|
||||
USER_AGENT = 'Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101210 Firefox/3.6.13'
|
||||
USER_AGENT = 'Mozilla/5.0 (X11; Linux x86_64; rv:25.0) Gecko/20100101 Firefox/25.0'
|
||||
|
||||
def find_image_urls(br, ans):
|
||||
import urlparse
|
||||
for w in br.page.mainFrame().documentElement().findAll('.images_table a[href]'):
|
||||
for w in br.page.mainFrame().documentElement().findAll('div#ires a.rg_l[href]'):
|
||||
try:
|
||||
imgurl = urlparse.parse_qs(urlparse.urlparse(unicode(w.attribute('href'))).query)['imgurl'][0]
|
||||
except:
|
||||
# import traceback
|
||||
# traceback.print_exc()
|
||||
continue
|
||||
if imgurl not in ans:
|
||||
ans.append(imgurl)
|
||||
|
Loading…
x
Reference in New Issue
Block a user