google-bard-api icon indicating copy to clipboard operation
google-bard-api copied to clipboard

Failing to get response

Open izdrail opened this issue 1 year ago • 4 comments

When running it seems form me it's failing at this functionality. def __get_snlm0e(self): resp = self.session.get(url="https://bard.google.com/", timeout=10) # Find "SNlM0e":"<ID>" if resp.status_code != 200: raise Exception("Could not get Google Bard") print(resp.text) exit(0) SNlM0e = re.search(r"SNlM0e\":\"(.*?)\"", resp.text).group(1) return SNlM0e For some reason he cannot finds the SNlM0e in the response text

izdrail avatar Jul 19 '23 11:07 izdrail

https://github.com/acheong08/Bard Try this.

shiyishiaa avatar Jul 20 '23 08:07 shiyishiaa

To retrieve the SNlM0e value from Bard, you must include an additional cookie in the request. Specifically, you need to send the key-value pair for __Secure-1PSIDTS in the request. You can place this key-value pair just below the entry for __Secure-1PSID.

WebAI to API

Bard Cookie

Amm1rr avatar Aug 12 '23 20:08 Amm1rr

Thanks for sharing that . Did you managed to make it an container ? I've done an implementation here https://github.com/Amm1rr/WebAI-to-API/pull/18/files/207911c1af3c49f686bd45b6988980a76e469af4

izdrail avatar Sep 06 '23 17:09 izdrail

Yeah sure, thanks for the pull request. I will review it and provide feedback this week.

Amm1rr avatar Sep 09 '23 19:09 Amm1rr