Open garyfeng opened 2 years ago
The current similar_images tag composes google image search URL like the following:
similar_images
searchUrl = 'https://www.google.com/searchbyimage?site=search&sa=X&image_url=' + similar_images headers = {} headers[ 'User-Agent'] = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36" req1 = urllib.request.Request(searchUrl, headers=headers) resp1 = urllib.request.urlopen(req1) content = str(resp1.read()) l1 = content.find('AMhZZ') l2 = content.find('&', l1) urll = content[l1:l2] newurl = "https://www.google.com/search?tbs=sbi:" + urll + "&site=search&sa=X" req2 = urllib.request.Request(newurl, headers=headers) resp2 = urllib.request.urlopen(req2) l3 = content.find('/search?sa=X&q=') l4 = content.find(';', l3 + 19) urll2 = content[l3 + 19:l4]``` return urll2
This has stopped working. It looks like the URL urll2 now contains some XML fragment, suggesting this two-part process no longer works.
urll2
The current
similar_images
tag composes google image search URL like the following:This has stopped working. It looks like the URL
urll2
now contains some XML fragment, suggesting this two-part process no longer works.