acheong08 / Bard

Python SDK/API for reverse engineered Google Bard
MIT License
1.42k stars 177 forks source link

seems not working anymore (Response code not 200. Response Status is 302) #48

Closed 2-3-5-7 closed 1 year ago

2-3-5-7 commented 1 year ago

use the example code from README

result

>>> chatbot = Chatbot(token)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/ubuntu/test/venv/lib/python3.11/site-packages/Bard.py", line 63, in __init__
    self.async_chatbot = self.loop.run_until_complete(
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/home/ubuntu/test/venv/lib/python3.11/site-packages/Bard.py", line 143, in create
    instance.SNlM0e = await instance.__get_snlm0e()
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/test/venv/lib/python3.11/site-packages/Bard.py", line 196, in __get_snlm0e
    raise Exception(
Exception: Response code not 200. Response Status is 302
fakebhai commented 1 year ago

same issue

acheong08 commented 1 year ago

Update cookie

2-3-5-7 commented 1 year ago

Refresh the cookie (use new __Secure-1PSID) still yield the same result, version 1.3.1

fakebhai commented 1 year ago

Update cookie

updated still same issue.

acheong08 commented 1 year ago

Can you guys check the location of the redirect? Might be a regional redirect

2-3-5-7 commented 1 year ago

I printed resp.headers, the location is https://bard.google.com/?hl=en

    ("content-type", "application/binary"),
    ("vary", "Sec-Fetch-Dest, Sec-Fetch-Mode, Sec-Fetch-Site"),
    ("cache-control", "no-cache, no-store, max-age=0, must-revalidate"),
    ("pragma", "no-cache"),
    ("expires", "Mon, 01 Jan 1990 00:00:00 GMT"),
    ("date", "Sat, 10 Jun 2023 15:01:08 GMT"),
    ("location", "https://bard.google.com/?hl=en"),
    ("p3p", 'CP="This is not a P3P policy! See g.co/p3phelp for more info."'),
    (
        "content-security-policy",
        "script-src 'report-sample' 'nonce-Fay09JUjMmKvDARSEzmqiw' 'unsafe-inline';object-src 'none';base-uri 'self';report-uri /_/BardChatUi/cspreport;worker-src 'self'",
    ),
....

follow_redirects seems work, there is no problem with 1.3.2 now