# Bard <img src="https://www.gstatic.com/lamda/images/favicon_v1_150160cddff7f294ce30.svg" width="35px" />
Reverse engineering of Google's Bard chatbot API
## Installation
```bash
$ pip3 install --upgrade GoogleBard
```
## Authentication
Go to https://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
```bash
$ 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:
```bash
# 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](https://github.com/acheong08/Bard/blob/main/DOCUMENTATION.md)
```python
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](https://github.com/discordtehe) - Derivative of his original reverse engineering
Raw data
{
"_id": null,
"home_page": "https://github.com/acheong08/Bard",
"name": "GoogleBard",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "",
"author": "Antonio Cheong",
"author_email": "acheong@student.dalat.org",
"download_url": "https://files.pythonhosted.org/packages/56/65/3110785c07312224408c5a5a8ba5348171d4a472cc693c337548246e67b0/GoogleBard-2.1.0.tar.gz",
"platform": null,
"description": "# Bard <img src=\"https://www.gstatic.com/lamda/images/favicon_v1_150160cddff7f294ce30.svg\" width=\"35px\" />\nReverse engineering of Google's Bard chatbot API\n\n## Installation\n```bash\n $ pip3 install --upgrade GoogleBard\n```\n\n## Authentication\nGo to https://bard.google.com/\n\n- F12 for console\n- Copy the values\n - Session: Go to Application \u2192 Cookies \u2192 `__Secure-1PSID` and `__Secure-1PSIDTS`. Copy the value of those cookie.\n\n## Usage\n\n```bash\n$ python3 -m Bard -h\nusage: Bard.py [-h] --session <__Secure-1PSID> --session_ts <__Secure-1PSIDTS>\n\noptions:\n -h, --help show this help message and exit\n --session --session_ts pass two cookies\n```\n\n### Quick mode\n```\n$ export BARD_QUICK=\"true\"\n$ export BARD__Secure_1PSID=\"<__Secure-1PSID>\"\n$ export BARD__Secure_1PSIDTS=\"<__Secure-1PSIDTS>\"\n$ python3 -m Bard\n```\nEnvironment variables can be placed in .zshrc.\n\nExample bash shortcut:\n```bash\n# USAGE1: bard QUESTION\n# USAGE2: echo \"QUESTION\" | bard\nbard () {\n\texport BARD_QUICK=true\n\texport BARD__Secure_1PSID=<__Secure-1PSID>\n\texport BARD__Secure_1PSIDTS=<__Secure-1PSIDTS>\n\tpython3 -m Bard \"${@:-$(</dev/stdin)}\" | tail -n+7\n}\n```\n\n## [Developer Documentation](https://github.com/acheong08/Bard/blob/main/DOCUMENTATION.md)\n```python\nfrom os import environ\nfrom Bard import Chatbot\n\nSecure_1PSID = environ.get(\"BARD__Secure_1PSID\")\nSecure_1PSIDTS = environ.get(\"BARD__Secure_1PSIDTS\")\nchatbot = Chatbot(Secure_1PSID, Secure_1PSIDTS)\n\nchatbot.ask(\"Hello, how are you?\")\n\n```\n\nCredits:\n- [discordtehe](https://github.com/discordtehe) - Derivative of his original reverse engineering\n",
"bugtrack_url": null,
"license": "MIT License",
"summary": "Reverse engineering of Google's Bard chatbot",
"version": "2.1.0",
"project_urls": {
"Bug Report": "https://github.com/acheong08/Bard/issues/new",
"Homepage": "https://github.com/acheong08/Bard"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "f9ccb5d84c60200dba531278c066d689221759f5c5845264ad8c8e7246c51a94",
"md5": "f17af8f7d302965b803c4276531823f3",
"sha256": "0d1af4a1aa8aa81c257ffff8ea52e6c2ef4e9a04a1a1f6a3f0a9e6c1fbf2c1fa"
},
"downloads": -1,
"filename": "GoogleBard-2.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "f17af8f7d302965b803c4276531823f3",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 6329,
"upload_time": "2023-07-20T10:42:14",
"upload_time_iso_8601": "2023-07-20T10:42:14.121940Z",
"url": "https://files.pythonhosted.org/packages/f9/cc/b5d84c60200dba531278c066d689221759f5c5845264ad8c8e7246c51a94/GoogleBard-2.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "56653110785c07312224408c5a5a8ba5348171d4a472cc693c337548246e67b0",
"md5": "bd0567be3bb9076d28decb96ceaa1d5c",
"sha256": "34c9063ef083c0398344d74fca79c843707fb3add438751a37471f7ddec8f397"
},
"downloads": -1,
"filename": "GoogleBard-2.1.0.tar.gz",
"has_sig": false,
"md5_digest": "bd0567be3bb9076d28decb96ceaa1d5c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 6093,
"upload_time": "2023-07-20T10:42:15",
"upload_time_iso_8601": "2023-07-20T10:42:15.661859Z",
"url": "https://files.pythonhosted.org/packages/56/65/3110785c07312224408c5a5a8ba5348171d4a472cc693c337548246e67b0/GoogleBard-2.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-07-20 10:42:15",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "acheong08",
"github_project": "Bard",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "googlebard"
}