dsdanielpark / Bard-API

The unofficial python package that returns response of Google Bard through cookie value.
https://pypi.org/project/bardapi/
MIT License
5.34k stars 528 forks source link

Exception: SNlM0e value not found. #143

Closed GvdDool closed 1 year ago

GvdDool commented 1 year ago

Following up on a post from nikk-16 on the same topic:

There is no issue int this API. But after excessive usage, the Google knows that cookie is having unauthorized access so the 1PSID is revert in some form.

The reason we get : Exception: SNlM0e value not found. Double-check __Secure-1PSID value or pass it as token='xxxxx'

How can you get rid of it: Clear cookies of bard.google.com and again

  • login into the account
  • F12 > Applications > Cookies > bard > __Secure-1PSID
  • Copy cookie and paste into your code.

Re run and you are good to go.

Originally posted by @nikk-16 in https://github.com/dsdanielpark/Bard-API/issues/99#issuecomment-1633060128

My problem is that the cookies seem to expire in 10 minutes and then I have to manually reset the browser (incognito on FireFox) while I am working on a notebook in Chrome. I am more than happy to change my coding environment if this helps, but closing/cleaning/restarting the browser is not very efficient - all suggestions are welcome.

Happy coding, Gijs

thewh1teagle commented 1 year ago

@dsdanielpark Looks like Google added captcha into Bard, If you don't send the cookie which solved by captcha manually, Google will response with status 429

GvdDool commented 1 year ago

@dsdanielpark - I know you are busy with another project, but is there a workaround for this problem?

dsdanielpark commented 1 year ago

When Google's internal interface API policy was more lenient, the cookie values remained unchanged for a few weeks to several months. However, currently, different API policies are followed based on regions and accounts, and they have been changed.

The unresponsive error with various reported causes also appears differently for some individuals.

As a result, although the cookie values are now frequently updated, there is a high possibility that this package will eventually become unusable, and you may need to use the official PaLM2 API.

Furthermore, I'm not sure about the specific environment you are using, but if manually resetting cookies is cumbersome, you can refer to Auto Cookie Bard. By keeping the Bard web UI active on certain browsers like Edge and resetting only specific browsers, you can automatically refresh the cookie values.

Regarding CAPTCHA, it is designed to prevent access from automated software and verify human presence, so there is no way to bypass CAPTCHA. There are no plans to support this at the package level.



Regarding this issue, we regret to inform you that there are no further developments possible from external sources, and it does not address a widely requested use case, so we do not plan to invest significant time in it.

As this issue does not pertain to the Bard-API package, we will be closing this matter.

GvdDool commented 1 year ago

@dsdanielpark , thank you for the explanation; I will try to keep Bard active on Edge and make it work. Unfortunately, I can't use the official PaLM2 API because it's the active internet link I would like to use for my topic, and the official PaLM2 API is static.