Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Antonio Cheong committed Feb 15, 2023
1 parent 8df309b commit 62fedbb
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 18 deletions.
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<img alt="Python version" src="https://img.shields.io/badge/python-3.7+-blue.svg">
</p>

#
#

> ### UPDATE 2023/02/13 - Public access shut down by Microsoft
> ### UPDATE 2023/02/14 - Do not use for now while I verify its safety
Expand Down Expand Up @@ -42,52 +42,52 @@
```bash
python3 -m pip install EdgeGPT --upgrade
```
### Requirements

### Requirements
We have a shared token for public use. If you have your own account with access, you can use that instead.

- python 3.7+
- Microsoft Edge (Required)
- A Microsoft Account with early access to http://bing.com/chat (Required)


<details>
<summary>

### Checking access (Required)

</summary>

- Install the latest version of Microsoft Edge
- Open http://bing.com/chat
- If you see a chat feature, you are good to go

</details>


<details>
<summary>

### Getting authentication (Required)

</summary>

- Install the cookie editor extension for [Chrome](https://chrome.google.com/webstore/detail/cookie-editor/hlkenndednhfkekhgcdicdfddnkalmdm) or [Firefox](https://addons.mozilla.org/en-US/firefox/addon/cookie-editor/)
- Go to `bing.com`
- Open the extension
- Click "Export" on the bottom right (This saves your cookies to clipboard)
- Paste your cookies into a file `cookies.json`

</details>



## Usage

### Quick start

```
$ python3 -m EdgeGPT -h
$ python3 -m EdgeGPT -h
EdgeGPT - A demo of reverse engineering the Bing GPT chatbot
Repo: github.com/acheong08/EdgeGPT
Expand All @@ -97,7 +97,7 @@ We have a shared token for public use. If you have your own account with access,
Type !exit to exit
Enter twice to send message
usage: EdgeGPT.py [-h] [--no-stream] --cookie-file COOKIE_FILE
options:
Expand Down Expand Up @@ -138,7 +138,7 @@ if __name__ == "__main__":


## Contributors
This project exists thanks to all the people who contribute.
This project exists thanks to all the people who contribute.

<a href="https://github.com/acheong08/EdgeGPT/graphs/contributors">
<img src="https://contrib.rocks/image?repo=acheong08/EdgeGPT" />
Expand Down
11 changes: 8 additions & 3 deletions src/EdgeGPT.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
import json
import os
import sys
from typing import Generator, Optional
from typing import Generator
from typing import Optional

import tls_client
import websockets.client as websockets
Expand All @@ -22,6 +23,7 @@
"referer": "https://www.bing.com/",
"sec-ch-ua": '"Chromium";v="110", "Not A(Brand";v="24", "Microsoft Edge";v="110"',
"sec-ch-ua-platform": "Windows",
"x-forwarded-for": "8.8.8.8",
}


Expand Down Expand Up @@ -110,7 +112,7 @@ def __init__(self) -> None:
}
self.session = tls_client.Session(client_identifier="chrome_108")
cookie_file = json.loads(
open(os.environ.get("COOKIE_FILE"), "r", encoding="utf-8").read()
open(os.environ.get("COOKIE_FILE"), encoding="utf-8").read(),
)
for cookie in cookie_file:
self.session.cookies.set(cookie["name"], cookie["value"])
Expand Down Expand Up @@ -322,7 +324,10 @@ async def main():
parser = argparse.ArgumentParser()
parser.add_argument("--no-stream", action="store_true")
parser.add_argument(
"--cookie-file", type=str, default="cookies.json", required=True
"--cookie-file",
type=str,
default="cookies.json",
required=True,
)
args = parser.parse_args()
os.environ["COOKIE_FILE"] = args.cookie_file
Expand Down

0 comments on commit 62fedbb

Please sign in to comment.