如果您愿意安装请求模块,这很容易做到。反向图像搜索工作流程当前由单个POST请求组成,该请求具有对上载URL的多部分主体,对此的响应是重定向到实际结果页面。
import requestsimport webbrowserfilePath = '/mnt/Images/test.png'searchUrl = 'http://www.google.hr/searchbyimage/upload'multipart = {'enpred_image': (filePath, open(filePath, 'rb')), 'image_content': ''}response = requests.post(searchUrl, files=multipart, allow_redirects=False)fetchUrl = response.headers['Location']webbrowser.open(fetchUrl)
当然,请记住,Google可能会决定随时更改此工作流程!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)