Giter Club home page Giter Club logo

Comments (14)

acheong08 avatar acheong08 commented on June 18, 2024

Attempts to solve:

  • Ensure you are only signed in to 1 account.
  • Ensure your IP address is in the US (or other supported regions)

from bard.

kjenney avatar kjenney commented on June 18, 2024

I'm seeing the same error. My IP address is in the US, and I'm only signed in to one account.

from bard.

jonrhaider avatar jonrhaider commented on June 18, 2024

For everyone's convenience (as an easy meanwhile solution while this is being resolved), you can obtain the SNlM0e directly from your Bard browser session. I mean if you were already going to open the dev tools in that window to get the cookie from 'Applications' tab, might as well just use console.log(WIZ_global_data.SNlM0e); in the console window to get the SNlM0e value, then you could copy and paste both in one trip to the browser window.

from bard.

kjenney avatar kjenney commented on June 18, 2024

How do you get the module to use the value that you've extracted?

from bard.

jonrhaider avatar jonrhaider commented on June 18, 2024

How do you get the module to use the value that you've extracted?

Similar to how you pass the cookie string value to the Bard.py script

bard () {
	export BARD_QUICK=true
	export BARD_SESSION=<REDACTED>.
	python3 -m Bard "${@:-$(</dev/stdin)}" | tail -n+7
}

you could do the same for SNlM0e:

        export BARD_SNlM0e=<REDACTED>.

Then you could modify your __get_snlm0e(self): function to just call it from os env and avoid the whole api request:

def __get_snlm0e(self):
        SNlM0e= os.getenv("BARD_SNlM0e")
        return SNlM0e

I do something similar using NodeJS in my project DuelGPT (a front-end for using ChatGPT and Bard side-by-side - minimal backend code)

from bard.

kjenney avatar kjenney commented on June 18, 2024

Exporting SNlM0e from console gives me a different error:

Google Bard encountered an error:
b')]}'\n\n38\n[["wrb.fr",null,null,null,null,[7]]]\n56\n[["di",52],["af.httprm",51,"-8317639822438177330",23]]\n25\n[["e",4,null,null,131]]\n'.

from bard.

Delamcode avatar Delamcode commented on June 18, 2024

Exporting SNlM0e from console gives me a different error:

Google Bard encountered an error:
b')]}'\n\n38\n[["wrb.fr",null,null,null,null,[7]]]\n56\n[["di",52],["af.httprm",51,"-8317639822438177330",23]]\n25\n[["e",4,null,null,131]]\n'.

Yep having this too…

from bard.

karlzipple avatar karlzipple commented on June 18, 2024

Works great when I call it from the command line, but when I try to use it in a script I keep getting the same error.

from Bard import Chatbot  
token = "Current Cookie Value"  
chatbot = Chatbot(token)  
chatbot.ask("Hello, how are you?")

produces 'NoneType' object is not iterable. I'm sure I'm missing something obvious

from bard.

YanJiaHuan avatar YanJiaHuan commented on June 18, 2024

@karlzipple You can go to Bard.py to change the functionality of 'def ask(self, message: str) -> dict:', print out the 'json_chat_data' to see what is your task-oriented requirement, and customize the 'results' yourself to skip the Nonetype error. That could be a cheap solution.

from bard.

fractaldna22 avatar fractaldna22 commented on June 18, 2024

How do you get the module to use the value that you've extracted?

Similar to how you pass the cookie string value to the Bard.py script

bard () {
	export BARD_QUICK=true
	export BARD_SESSION=<REDACTED>.
	python3 -m Bard "${@:-$(</dev/stdin)}" | tail -n+7
}

you could do the same for SNlM0e:

        export BARD_SNlM0e=<REDACTED>.

Then you could modify your __get_snlm0e(self): function to just call it from os env and avoid the whole api request:

def __get_snlm0e(self):
        SNlM0e= os.getenv("BARD_SNlM0e")
        return SNlM0e

I do something similar using NodeJS in my project DuelGPT (a front-end for using ChatGPT and Bard side-by-side - minimal backend code)

can you please retype this. What the hell is . ? Does it contain < > ? Does it end with a period? <1687168999467>. ? is it <DFuTz6sfj1k3Bu814Vj8_3JhXhvE:1687168999467> ? is it DFuTz6sfj1k3Bu814Vj8_3JhXhvE:1687168999467? is it "DFuTz6sfj1k3Bu814Vj8_3JhXhvE:1687168999467" ? Please. Be specific.

from bard.

kjenney avatar kjenney commented on June 18, 2024

The latest release resolves this issue. You don't need to make any modifications to the code for this to work. Just pull main.

Here's my working code, copied from the README.md in ~/.bash_profile

# USAGE1: bard QUESTION
# USAGE2: echo "QUESTION" | bard
bard () {
	export BARD_QUICK=true
        export BARD_SESSION="REDACTED"
	python3 -m Bard "${@:-$(</dev/stdin)}" | tail -n+7
}

Here's an example of it working:

$ bard "What is the capital of Argentina?"
/usr/local/lib/python3.10/site-packages/Bard.py:62: DeprecationWarning: There is no current event loop
  self.loop = asyncio.get_event_loop()
The capital of Argentina is Buenos Aires. It is the most populous city in Argentina, with a metropolitan area of over 15 million people.
Buenos Aires is located on the western shore of the Río de la Plata, on South America's southeastern coast. The city was founded in 1536
by Spanish colonists, and it became the capital of Argentina in 1880. Buenos Aires is a major economic, cultural, and political center in
South America. It is home to the Argentine National Congress, the Supreme Court of Argentina, and the Casa Rosada, the official residence
of the President of Argentina. Buenos Aires is also a major center for tourism, with a wide variety of attractions, including museums,
theaters, restaurants, and nightlife.

from bard.

fractaldna22 avatar fractaldna22 commented on June 18, 2024

i still cant get it to work :( Im using the chatbot usecase, with ChatGPT-DIscord-Bot-1.5.1. By commenting out the errors and pasting in the SNlM0e directly instead of using the __Secure_1*** cookie, because it gives me the "must end with a dot" error even though it DOES end with a dot, i finally get it to fully load the discord bot, but when i go to get a response it says
Google Bard encountered an error: b')]}'\n\n38\n[["wrb.fr",null,null,null,null,[7]]]\n56\n[["di",60],["af.httprm",60,"-8234551735768967562",38]]\n25\n[["e",4,null,null,131]]\n'.
I know its still related to the cookie.

I dont know how
bard () {
export BARD_QUICK=true
export BARD_SESSION="REDACTED"
python3 -m Bard "${@:-$(</dev/stdin)}" | tail -n+7
}

relates in any possible way

from bard.

fractaldna22 avatar fractaldna22 commented on June 18, 2024
async def __get_snlm0e(self):
        # Find "SNlM0e":"<ID>"
        #if not self.session_id or self.session_id[-1] != ".":
        #    raise Exception(
        #         "__Secure-1PSID value must end with a single dot. Enter correct __Secure-1PSID value.",
        #    )
        resp = await self.session.get(
            "https://bard.google.com/",
            timeout=10,
            follow_redirects=True,
        )
        if resp.status_code != 200:
            raise Exception(
                f"Response code not 200. Response Status is {resp.status_code}",
            )
        SNlM0e = re.search(r"SNlM0e\":\"(.*?)\"", "AFuTs6sfj1k3Bu814Vj8_3JhXhvE:1687168999468")
        ##if not SNlM0e:
        #    raise Exception(
        #        "SNlM0e value not found in response. Check __Secure-1PSID value.",
        #    )
        return "(.1687168999468?)"

from bard.

dhnam avatar dhnam commented on June 18, 2024

Worked yesterday; Not working today. I wonder why it happen, but getting site with cURL (with and without cookie) doesn't include SNlM0e too.

from bard.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.