MyGit
🚩收到GitHub仓库的更新通知

acheong08/Bard

Fork: 181 Star: 1434 (更新于 2024-04-17 19:58:40)

license: MIT

Language: Python .

Python SDK/API for reverse engineered Google Bard

最后发布版本: 2.1.0 ( 2023-07-20 18:41:05)

GitHub网址

✨免费申请网站SSL证书,支持多域名和泛域名,点击查看

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-1PSID and __Secure-1PSIDTS. Copy the value of those cookie.

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
}

Implementation:

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)

answer = chatbot.ask("Hello, how are you?")

print(answer['content']

Async Implementation:

import asyncio
from os import environ
from Bard import AsyncChatbot

Secure_1PSID = environ.get("BARD__Secure_1PSID")
Secure_1PSIDTS = environ.get("BARD__Secure_1PSIDTS")

async def main():
    chatbot = await AsyncChatbot.create(Secure_1PSID, Secure_1PSIDTS)
    response = await chatbot.ask("Hello, how are you?")
    print(response['content'])

asyncio.run(main())

Developer Documentation

Credits:

  • discordtehe - Derivative of his original reverse engineering

最近版本更新:(数据更新于 2024-04-27 02:11:29)

2023-07-20 18:41:05 2.1.0

2023-07-20 15:02:19 2.0.0

2023-06-27 01:24:39 1.4.0

2023-06-26 03:46:13 1.3.3

2023-06-10 09:53:28 1.3.2

2023-06-09 18:18:42 1.3.1

2023-06-02 01:38:11 1.3.0

2023-06-02 01:05:03 1.2.2

2023-06-01 12:33:58 1.2.1

2023-05-28 20:52:00 1.2.0

主题(topics):

chatbot, google, google-bard, gpt, reverse-engineering

acheong08/Bard同语言 Python最近更新仓库

2024-04-30 23:24:05 plaintextpackets/netprobe_lite

2024-04-30 13:44:53 jxxghp/MoviePilot

2024-04-30 06:17:08 Azure/PyRIT

2024-04-29 04:49:50 xtekky/gpt4free

2024-04-29 01:33:56 linruowuyin/Fhoe-Rail

2024-04-28 04:29:49 marimo-team/marimo