# ChatGPT Shared Chat Exporter Export a public ChatGPT shared conversation link to a clean Markdown file. The exporter reads the structured conversation data embedded in ChatGPT share pages, then writes the visible user/assistant conversation path as Markdown with clean metadata tables. ## Features - exports public `https://chatgpt.com/share/...` links - preserves Markdown-formatted message content, including headings, lists, code blocks, and tables - includes conversation metadata such as title, source URL, conversation ID, timestamps, and model slug - includes per-message metadata such as author, message ID, created/updated time, status, channel, recipient, model, request ID, and turn ID - records uploaded image/file metadata such as name, MIME type, size, dimensions, and source pointer - can include hidden/system/internal nodes when requested - uses only the Python standard library ## Requirements - Python 3.9 or newer - network access to `chatgpt.com` for live exports ## Quick Start Run directly from the repository: ```bash python3 main.py "https://chatgpt.com/share/YOUR_SHARE_ID" ``` By default, exports are written to `exports/`, which is ignored by Git so private chat content is not committed accidentally. ## Install Locally ```bash python3 -m pip install -e . chatgpt-share-exporter "https://chatgpt.com/share/YOUR_SHARE_ID" ``` ## Options ```bash chatgpt-share-exporter URL --timezone UTC chatgpt-share-exporter URL --include-hidden chatgpt-share-exporter URL --all-nodes chatgpt-share-exporter URL --stdout chatgpt-share-exporter URL -o my_exports --overwrite ``` - `--timezone`: format message times in `local`, `UTC`, or an IANA timezone like `Asia/Tehran` - `--include-hidden`: include system/internal messages that ChatGPT normally hides - `--all-nodes`: export every mapping node, including non-selected branches - `--stdout`: print Markdown instead of writing a file - `--overwrite`: replace the default output file instead of creating a numbered copy - `--html-file`: parse an already downloaded share page instead of fetching the URL - `--timeout`: set the download timeout in seconds ## Development Run tests: ```bash python3 -m unittest discover -s tests ``` Run a syntax check: ```bash python3 -m py_compile main.py chatgpt_share_exporter.py tests/test_exporter.py ``` ## Notes - Only public ChatGPT shared links are supported. - If ChatGPT returns a browser challenge instead of the shared chat HTML, the exporter cannot parse that response. - ChatGPT may change its share-page format; the parser is tested against the current embedded React Router payload and a fallback `__NEXT_DATA__` payload. - This project is not affiliated with OpenAI.