GithubHelp home page GithubHelp logo

3281448091 / easychatgpt Goto Github PK

View Code? Open in Web Editor NEW
185.0 5.0 24.0 205 KB

An unofficial yet elegant interface of the ChatGPT API using browser automation that bypasses cloudflare detection and recaptchas.

License: GNU General Public License v2.0

Shell 0.27% Python 99.73%
chatgpt python selenium gpt-3 gptchat library reverse-engineering

easychatgpt's Introduction

EasyChatGPT

License: GPL v3Maintenancemade-with-python

An unofficial yet elegant interface of the ChatGPT API using browser automation that bypasses cloudflare detection and recaptchas.

Features

  • Bypass Cloudflare's anti-bot protection using undetected_chromedriver
  • Complementary and fast Audio Recaptcha solver using the pypasser library.

Installation

You must install ffmpeg and ffprobe on your machine before running.

Install On Windows
Install On Linux
Install On MacOS

Install the official easyChatGPT package

pip install easychatgpt

Environment Variables

To run this project, you will need to add the following environment variables to your .env file

OPENAI_EMAIL

OPENAI_PASSWORD

Copy the .env file and put in your openai email and password

cp .env.example .env

Usage / Demo

Simple Usage

from easychatgpt import ChatClient
import os
from dotenv import load_dotenv


load_dotenv()
OPENAI_EMAIL = os.getenv("OPENAI_EMAIL")
OPENAI_PASSWORD = os.getenv("OPENAI_PASSWORD")

chat = ChatClient(OPENAI_EMAIL,OPENAI_PASSWORD)

answer = chat.interact("Introduce your self")

print(answer)

More examples to look at

Acknowledgement

ChatGPT_Selenium
PyPasser

easychatgpt's People

Contributors

3281448091 avatar erjanmx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

easychatgpt's Issues

Error logging in

Not sure if it's related to captcha. It goes too fast

(base) ➜ knowledge git:(main) ✗ /opt/homebrew/bin/python3 /Users/ghoshmac/Documents/code/k nowledge/miniproj/chatgpt/chat.py Browser successfully launched, logging in to account... Traceback (most recent call last): File "/Users/ghoshmac/Documents/code/knowledge/miniproj/chatgpt/chat.py", line 7, in <module> chat = ChatClient(OPENAI_EMAIL,OPENAI_PASSWORD) File "/opt/homebrew/lib/python3.10/site-packages/easychatgpt/chatgpt.py", line 44, in __init__ self.__login(username, password) File "/opt/homebrew/lib/python3.10/site-packages/easychatgpt/chatgpt.py", line 68, in __login email_box.send_keys(username) File "/opt/homebrew/lib/python3.10/site-packages/selenium/webdriver/remote/webelement.py", line 234, in send_keys Command.SEND_KEYS_TO_ELEMENT, {"text": "".join(keys_to_typing(value)), "value": keys_to_typing(value)} File "/opt/homebrew/lib/python3.10/site-packages/selenium/webdriver/common/utils.py", line 148, in keys_to_typing for i in range(len(val)): TypeError: object of type 'NoneType' has no len() (base) ➜ knowledge git:(main) ✗

TypeError: expected str, bytes or os.PathLike object, not NoneType

Hello, I installed ffpmg and dotenv, after run the final code, it gives me this error:

TypeError                                 Traceback (most recent call last)
[<ipython-input-3-8f191ce955a1>](https://localhost:8080/#) in <module>
      1 from easychatgpt import ChatClient
      2 
----> 3 chat = ChatClient("YOUR EMAIL","YOUR PASSWORD")
      4 
      5 answer = chat.interact("Introduce your self")

4 frames
[/usr/lib/python3.9/posixpath.py](https://localhost:8080/#) in dirname(p)
    150 def dirname(p):
    151     """Returns the directory component of a pathname"""
--> 152     p = os.fspath(p)
    153     sep = _get_sep(p)
    154     i = p.rfind(sep) + 1

TypeError: expected str, bytes or os.PathLike object, not NoneType```

I dont know how to login with my OPENAI account, you can see my notebook
https://colab.research.google.com/drive/1BBfva2wpJ1x-Ht6UDOjHlkufEms_rvdx?usp=sharing

thread_selected_xq breaks after animation

When a new thread is created and a first message is sent, the name of the thread will be renamed automatically and the thread selected class will change from
flex py-3 px-3 items-center gap-3 relative rounded-md cursor-pointer break-all pr-14 bg-gray-800 hover:bg-gray-800 group
to
flex py-3 px-3 items-center gap-3 relative rounded-md cursor-pointer break-all pr-14 bg-gray-800 hover:bg-gray-800 group animate-flash

login with google ?

"Hello, I have a question regarding signing up for ChatGPT. Since I have signed up using my Google account and do not have a password, I was wondering if it is possible to also sign up for the 'API' using Google? Thank you."

Error rasied when using headless mode

Hi, thanks for sharing this work.
The script runs perfectly well in gui mode, but i tried it in headless mode as i want to deploy it on a centos server, following error occured:

Browser successfully launched, logging in to account...
Updated session
Updated session
Updated session
Traceback (most recent call last):
  File "D:\tools\gpttools\chatgpt_tools.py", line 15, in <module>
    chat = ChatClient(OPENAI_EMAIL, OPENAI_PASSWORD, headless=True)
  File "D:\ProgramData\Anaconda3\envs\chatgpt\lib\site-packages\easychatgpt\chatgpt.py", line 85, in __init__
    self.__login(username, password)
  File "D:\ProgramData\Anaconda3\envs\chatgpt\lib\site-packages\easychatgpt\chatgpt.py", line 105, in __login
    login_button.click()
AttributeError: 'list' object has no attribute 'click'

Process finished with exit code 1

AttributeError: 'list' object has no attribute 'click' in chatgpt.py

Hello, thanks for great work.
I'm getting an error running sample app from readme:

  File "/root/easy/main.py", line 11, in <module>
    chat = ChatClient(OPENAI_EMAIL,OPENAI_PASSWORD)
  File "/usr/local/lib/python3.10/dist-packages/easychatgpt/chatgpt.py", line 87, in __init__
    self.__login(username, password)
  File "/usr/local/lib/python3.10/dist-packages/easychatgpt/chatgpt.py", line 107, in __login
    login_button.click()
AttributeError: 'list' object has no attribute 'click'

login_button seem to be an empty array for me.

Cannot install easychatgpt because depends on pypasser

ERROR: Cannot install easychatgpt==0.0.2, easychatgpt==0.0.3, easychatgpt==0.0.4, easychatgpt==0.0.5, easychatgpt==0.0.6, easychatgpt==0.0.7 and easychatgpt==0.0.8 because these package versions have conflicting dependencies.

The conflict is caused by:
easychatgpt 0.0.8 depends on pypasser
easychatgpt 0.0.7 depends on pypasser
easychatgpt 0.0.6 depends on pypasser
easychatgpt 0.0.5 depends on pypasser
easychatgpt 0.0.4 depends on pypasser
easychatgpt 0.0.3 depends on pypasser
easychatgpt 0.0.2 depends on pypasser

To fix this you could try to:

  1. loosen the range of package versions you've specified
  2. remove package versions to allow pip attempt to solve the dependency conflict

ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/user_guide/#fixing-conflicting-dependencies
(cuda102_torch) PS D:\qkmc\Desktop\easyChatGPT> pip install pypasser
Looking in indexes: http://pypi.douban.com/simple
ERROR: Could not find a version that satisfies the requirement pypasser (from versions: none)
ERROR: No matching distribution found for pypasser

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.