Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated code to be compatible with Cookie Policy page #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

LaurentMertens
Copy link

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

…eject cookie" page, the option "Reject all" is automatically selected.
@FlorianMgs
Copy link

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

@Vorrik
Copy link
Owner

Vorrik commented Jun 23, 2024

Sorry for the late reply, will check soon

@Vorrik Vorrik self-requested a review June 23, 2024 15:39
@Vorrik
Copy link
Owner

Vorrik commented Jun 23, 2024

@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
Copy link
Author

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
Copy link
Owner

Vorrik commented Jun 25, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants