Vorrik / Google-Reverse-Image-Search

A package to search image sources using google services
MIT License
12 stars 6 forks source link

Updated code to be compatible with Cookie Policy page #1

Open LaurentMertens opened 7 months ago

LaurentMertens commented 7 months ago

Upated upload_image.py so that when the first response is a "Accept/Reject cookie" page, the option "Reject all" is automatically selected.

FlorianMgs commented 1 month ago

@LaurentMertens Thanks a lot, this fixed my issue! @Vorrik can you please merge this? Thanks 🙏🏻

Vorrik commented 3 weeks ago

Sorry for the late reply, will check soon

Vorrik commented 3 weeks ago

@FlorianMgs @LaurentMertens Could you try this ` import requests

from http.cookiejar import DefaultCookiePolicy

s = requests.Session()

s.cookies.set_policy(DefaultCookiePolicy(blocked_domains=['consent.google.com']))

rev_img_searcher = ReverseImageSearcher(s)

res = rev_img_searcher.search(image_url) `

LaurentMertens commented 3 weeks ago

I get an error:

File "[...]/env/lib/python3.12/site-packages/google_img_source_search/image_uploader.py", line 21, in extract_image id_2 = py_obj['ds:0']['request'][1][7][0]


IndexError: list index out of range
Vorrik commented 3 weeks ago

I get an error:

File "[...]/env/lib/python3.12/site-packages/google_img_source_search/image_uploader.py", line 21, in extract_image id_2 = py_obj['ds:0']['request'][1][7][0]


IndexError: list index out of range

Hmm, I haven't been able to get this error yet. What country? Do you use proxy? Does the problem appear in time of first search? Can you also send img url