Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ChatGPT Web Automator

A Python-based automation tool that interacts with ChatGPT’s web interface using the Marionette driver for Firefox. It enables users to programmatically send prompts and retrieve responses, ideal for scripting repetitive tasks or integrating ChatGPT into workflows.

Table of Contents

Features

  • Interactive Prompting: Send prompts to ChatGPT’s web interface and retrieve responses programmatically.
  • Two Modes:
    • chatgpt_loop.py: Interactive CLI for continuous prompting until the user exits.
    • chatgpt_marionette.py: Single-prompt script for one-off interactions via command-line arguments.
  • Robust Response Handling: Waits for stable ChatGPT responses, ensuring complete and accurate output.
  • Error Handling: Gracefully handles missing elements and browser connection issues.
  • Lightweight: Minimal dependencies, relying on marionette-driver for browser automation.

Project Structure

ChatGPT-Web-Automator/
├── chatgpt_loop.py         # Interactive CLI for continuous ChatGPT prompting
├── chatgpt_marionette.py   # Single-prompt script for one-off ChatGPT interactions
├── requirements.txt        # Python dependencies
├── .gitignore             # Git ignore file
└── README.md              # Project documentation

Installation

  1. Clone the Repository:

    git clone https://github.com/NabiBukhsh-AI/ChatGPT-Web-Automator.git
    cd ChatGPT-Web-Automator
  2. Set Up a Virtual Environment (recommended):

    python -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
  3. Install Dependencies: Ensure Python 3.8+ is installed. Install the required package:

    pip install -r requirements.txt
  4. Set Up Firefox and Marionette:

    • Install Firefox.
    • Ensure geckodriver is installed and accessible in your system’s PATH:
      • Download geckodriver from GitHub.
      • Add it to your PATH (e.g., on Windows, place it in C:\Windows or a directory in your PATH).
    • Start Firefox with Marionette enabled on port 2828:
      firefox --marionette

Usage

  1. Interactive Mode (chatgpt_loop.py):

    • Run the script:
      python chatgpt_loop.py
    • Enter prompts interactively in the CLI. Type exit or quit to stop.
    • Example:
      💬 Enter your prompt (or type 'exit' to quit):
      > What is the capital of France?
      📝 Sending prompt...
      ⏳ Waiting for reply...
      🧠 ChatGPT replied:
      The capital of France is Paris.
      
  2. Single-Prompt Mode (chatgpt_marionette.py):

    • Run the script with a prompt as a command-line argument:
      python chatgpt_marionette.py "What is the capital of France?"
    • Example output:
      Prompt sent:
      What is the capital of France?
      🧠 ChatGPT replied:
      The capital of France is Paris.
      
  3. Prerequisites:

    • Ensure Firefox is running with Marionette enabled (firefox --marionette) before running either script.
    • Log in to ChatGPT’s web interface in Firefox to ensure the scripts can interact with the prompt textarea.

Contributing

Contributions are welcome! To contribute:

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature/your-feature).
  3. Commit your changes (git commit -m 'Add your feature').
  4. Push to the branch (git push origin feature/your-feature).
  5. Open a Pull Request.

Please read CONTRIBUTING.md for more details (create this file if you wish to formalize contribution guidelines).

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contact

Created by NabiBukhsh-AI. For feedback or suggestions, open an issue or contact me via GitHub.

About

A Python-based tool to automate interactions with ChatGPT’s web interface using Marionette and Firefox, enabling programmatic prompt submission and response retrieval.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages