Bard 
Reverse engineering of Google's Bard chatbot API
Installation
$ pip3 install --upgrade GoogleBard
Authentication
Go to https://bard.google.com/
- F12 for console
- Copy the values
- Session: Go to Application → Cookies →
__Secure-1PSIDand__Secure-1PSIDTS. Copy the value of those cookie.
- Session: Go to Application → Cookies →
Usage
$ python3 -m Bard -h
usage: Bard.py [-h] --session <__Secure-1PSID> --session_ts <__Secure-1PSIDTS>
options:
-h, --help show this help message and exit
--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" | bard
bard () {
export BARD_QUICK=true
export BARD__Secure_1PSID=<__Secure-1PSID>
export BARD__Secure_1PSIDTS=<__Secure-1PSIDTS>
python3 -m Bard "${@:-$(</dev/stdin)}" | tail -n+7
}
Developer Documentation
from os import environ
from Bard import Chatbot
Secure_1PSID = environ.get("BARD__Secure_1PSID")
Secure_1PSIDTS = environ.get("BARD__Secure_1PSIDTS")
chatbot = Chatbot(Secure_1PSID, Secure_1PSIDTS)
chatbot.ask("Hello, how are you?")
Credits:
- discordtehe - Derivative of his original reverse engineering
Metadata
Release files for GoogleBard 2.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| GoogleBard-2.1.0.tar.gz | 6.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| GoogleBard-2.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.4 kB
Release files / GoogleBard-2.1.0.tar.gz
| Download URL | GoogleBard-2.1.0.tar.gz |
|---|---|
| Size | 6.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
34c9063ef083c0398344d74fca79c843707fb3add438751a37471f7ddec8f397
|
|
BLAKE2b-256 checksum How to use checksums |
56653110785c07312224408c5a5a8ba5348171d4a472cc693c337548246e67b0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.17
|
Release files / GoogleBard-2.1.0-py3-none-any.whl
| Download URL | GoogleBard-2.1.0-py3-none-any.whl |
|---|---|
| Size | 6.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0d1af4a1aa8aa81c257ffff8ea52e6c2ef4e9a04a1a1f6a3f0a9e6c1fbf2c1fa
|
|
BLAKE2b-256 checksum How to use checksums |
f9ccb5d84c60200dba531278c066d689221759f5c5845264ad8c8e7246c51a94
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.17
|