{"id":25402226,"url":"https://github.com/st1vms/gptauto","last_synced_at":"2025-10-30T23:31:06.633Z","repository":{"id":174198119,"uuid":"651909833","full_name":"st1vms/gptauto","owner":"st1vms","description":"A fully functional ChatGPT selenium scraper written in Python","archived":false,"fork":false,"pushed_at":"2024-12-08T17:11:19.000Z","size":58,"stargazers_count":15,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-08T17:17:36.281Z","etag":null,"topics":["chatgpt","chatgpt-api","chatgpt-bot","chatgpt-python","documented","fast","firefox","geckodriver","gpt","gpt-3-5-turbo","messages","openai","prompts","python","scraper","selenium","selenium-wire","selgym","web"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/st1vms.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-06-10T13:18:53.000Z","updated_at":"2024-12-08T17:11:23.000Z","dependencies_parsed_at":null,"dependency_job_id":"eb7f319a-0364-4e34-a3ad-5b12d489901f","html_url":"https://github.com/st1vms/gptauto","commit_stats":null,"previous_names":["st1vms/gptauto"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/st1vms%2Fgptauto","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/st1vms%2Fgptauto/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/st1vms%2Fgptauto/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/st1vms%2Fgptauto/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/st1vms","download_url":"https://codeload.github.com/st1vms/gptauto/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239077442,"owners_count":19577665,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chatgpt","chatgpt-api","chatgpt-bot","chatgpt-python","documented","fast","firefox","geckodriver","gpt","gpt-3-5-turbo","messages","openai","prompts","python","scraper","selenium","selenium-wire","selgym","web"],"created_at":"2025-02-16T01:33:07.333Z","updated_at":"2025-10-30T23:31:06.279Z","avatar_url":"https://github.com/st1vms.png","language":"Python","readme":"# gptauto\n\n## What is this?\n\nThis Python scraper provides access to the conversational capabilities of [ChatGPT](https://chat.openai.com/) through a simple chat messaging interface.\n\nWhile not officially supported by OpenAI, this library can enable interesting conversational applications.\n\nIt allows for:\n\n- Creating chat sessions with ChatGPT and getting chat IDs.\n- Sending messages to specific chat ids, and even toggle chat history.\n- Get an ordered, strong typed list of messages from any chat.\n\nIt relies on [geckodriver](https://github.com/mozilla/geckodriver), [selenium-wire](https://github.com/wkeeling/selenium-wire) and [selgym (selenium)](https://github.com/st1vms/selgym) libraries only.\n\n## Table of Content\n\n- [Installation](#installation)\n- [Uninstallation](#uninstallation)\n- [Requirements](#requirements)\n- [Example Usage](#example-usage)\n  - [ask-gpt](#ask-gpt)\n  - [Using Python](#using-python)\n  - [Toggling Chat History](#toggling-chat-history)\n- [Known Bugs](#known-bugs)\n- [Disclaimer](#disclaimer)\n- [Donations](#donations)\n\n## Installation\n\nDownload this repository and install it from source by runnig this command inside the repository folder:\n\n```shell\npip install -e .\n```\n\n## Uninstallation\n\n```shell\npip uninstall gptauto\n```\n\n## Requirements\n\n- Python \u003e= 3.10\n- [geckodriver](https://github.com/mozilla/geckodriver/releases) installed in a folder registered in PATH\n- A valid login to [ChatGPT](https://chat.openai.com/) on a newly created Firefox profile\n  (A new Firefox profile is needed in order for `selenium-wire` proxy to work).\n- Disabling ChatGPT's chat history on this profile is also recommended.\n\n## Example usage\n\n### ask-gpt\n\nBy installing this library using `pip`, a command-line interface is provided, `ask-gpt`, it takes one positional argument, the input TEXT for chat-gpt, that can also be prepended with an header (prompt) using the `-p` string parameter.\n\nOther parameters are:\n\n```txt\n-f Firefox profile\n(Firefox root profile path string, default behaviour is creating a new one)\n\n-ts Type speed\n(Maximum type speed expressed as a float number \u003e= 0.001, defaults to 0.01)\nThis value is used to randomly sleep for a specific interval between each individual key-stroke.\n\n-nh No-Headless\n(Turn off selenium Headless mode, for debugging purposes)\n```\n\nThis utility is also pipe friendly, having the ability to pipe input strings as the Chat GPT input directly into the command.\n\nFor example in Linux distributions:\n\n```bash\necho \"Roll a D20\" | ask-gpt -p \"Only answer with a number\" | cat \"output.txt\"\n```\n\nOr in Windows CMD:\n\n```cmd\n( echo \"Roll a D20\" \u0026 ask-gpt -p \"Only answer with a number\" ) \u003e\u003e output.txt\n```\n\n### Using Python\n\n```py\nfrom gptauto.scraper import GPTScraper\n\n# Set to None to use default firefox profile\n# Set to a string with the root profile directory path\n# to use a different firefox profile\nPROFILE_PATH = None\n\n\ndef _main() -\u003e None:\n\n    scraper = GPTScraper(profile_path=PROFILE_PATH)\n    try:\n        # Creates a new webdriver instance\n        # opening chatgpt page\n        scraper.start()\n\n        # Pick text to send\n        text = input(\"\\nText\\n\u003e\u003e\").strip()\n        scraper.send_message(text)\n\n        # Waits for completion to finish\n        scraper.wait_completion()\n\n        # Retrieves chat messages\n        # as an ordered list of AssistantMessage\n        # or UserMessage\n        messages = list(scraper.get_messages())\n        if messages:\n            print(f\"\\nANSWER:\\n\\n{messages[-1].text}\\n\")\n    except KeyboardInterrupt:\n        return\n    finally:\n        # Gracefully quit the webdriver instance\n        scraper.quit()\n        # After calling quit()\n        # a new session can be started with .start()\n\n\nif __name__ == \"__main__\":\n    _main()\n```\n\n### Toggling chat history\n\n```py\nfrom gptauto.scraper import GPTScraper\n\n# Open new session on default firefox profile\nscraper = GPTScraper()\ntry:\n    scraper.start()\n\n    # Toggle chat history\n    # If On -\u003e Off\n    # If Off -\u003e On\n    scraper.toggle_history()\nfinally:\n    scraper.quit()\n```\n\n## Known bugs\n\n- Sometimes a captcha may appear after sending a message,\nso far this software does nothing to prevent this or act accordingly, if a captcha is triggered, the only current solution is to solve it manually, having non-headless behavior set by default.\n\n- Currently this software does not work in headless mode, I don't know if I will ever be able to find a solution in the near future. Feel free to open a pull request if you found a better one and would like to contribute 🦾\n\n## Disclaimer\n\nThis repository provides a way for automating free accounts on [ChatGPT](https://chat.openai.com/).\nPlease note that this software is not endorsed, supported, or maintained by OpenAI. Use it at your own discretion and risk. OpenAI may make changes to their official product or APIs at any time, which could affect the functionality of this software. We do not guarantee the accuracy, reliability, or security of the information and data retrieved using this API. By using this repository, you agree that the maintainers are not responsible for any damages, issues, or consequences that may arise from its usage. Always refer to OpenAI's official documentation and terms of use. This project is maintained independently by contributors who are not affiliated with OpenAI.\n\n## Donations\n\nA huge thank you in advance to anyone who wants to donate :)\n\n![Buy Me a Pizza](https://img.buymeacoffee.com/button-api/?text=1%20Pizza%20Margherita\u0026emoji=🍕\u0026slug=st1vms\u0026button_colour=0fa913\u0026font_colour=ffffff\u0026font_family=Bree\u0026outline_colour=ffffff\u0026coffee_col)\n","funding_links":["https://img.buymeacoffee.com/button-api/?text=1%20Pizza%20Margherita\u0026emoji="],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fst1vms%2Fgptauto","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fst1vms%2Fgptauto","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fst1vms%2Fgptauto/lists"}