Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Aug 10, 2023. It is now read-only.
/BardPublic archive

Python SDK/API for reverse engineered Google Bard

License

NotificationsYou must be signed in to change notification settings

acheong08/Bard

Repository files navigation

Reverse engineering of Google's Bard chatbot API

Installation

 $ pip3 install --upgrade GoogleBard

Authentication

Go tohttps://bard.google.com/

  • F12 for console
  • Copy the values
    • Session: Go to Application → Cookies →__Secure-1PSID and__Secure-1PSIDTS. Copy the value of those cookie.

Usage

$ python3 -m Bard -husage: Bard.py [-h] --session<__Secure-1PSID> --session_ts<__Secure-1PSIDTS>options:  -h, --help         show thishelp message andexit  --session --session_ts       pass two cookies

Quick mode

$ export BARD_QUICK="true"$ export BARD__Secure_1PSID="<__Secure-1PSID>"$ export BARD__Secure_1PSIDTS="<__Secure-1PSIDTS>"$ python3 -m Bard

Environment variables can be placed in .zshrc.

Example bash shortcut:

# USAGE1: bard QUESTION# USAGE2: echo "QUESTION" | bardbard () {export BARD_QUICK=trueexport BARD__Secure_1PSID=<__Secure-1PSID>export BARD__Secure_1PSIDTS=<__Secure-1PSIDTS>python3 -m Bard"${@:-$(</dev/stdin)}"| tail -n+7}

Implementation:

fromosimportenvironfromBardimportChatbotSecure_1PSID=environ.get("BARD__Secure_1PSID")Secure_1PSIDTS=environ.get("BARD__Secure_1PSIDTS")chatbot=Chatbot(Secure_1PSID,Secure_1PSIDTS)answer=chatbot.ask("Hello, how are you?")print(answer['content']

Async Implementation:

importasynciofromosimportenvironfromBardimportAsyncChatbotSecure_1PSID=environ.get("BARD__Secure_1PSID")Secure_1PSIDTS=environ.get("BARD__Secure_1PSIDTS")asyncdefmain():chatbot=awaitAsyncChatbot.create(Secure_1PSID,Secure_1PSIDTS)response=awaitchatbot.ask("Hello, how are you?")print(response['content'])asyncio.run(main())

Credits:

  • discordtehe - Derivative of his original reverse engineering

About

Python SDK/API for reverse engineered Google Bard

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors8

Languages


[8]ページ先頭

©2009-2026 Movatter.jp