A utility script designed to search for specific messages within a ChatGPT data export and to retrieve the titles of chats along with the dates of conversations containing those messages.
Navigating the nested structure of JSON in ChatGPT data exports can be challenging. This tool simplifies the process by enabling users to identify chat titles based on a keyword or phrase.
- Download your ChatGPT data export, which will be provided in a
.zip
file format. - Execute the script by specifying the path to your
.zip
file along with the target message you're searching for:
$ ./gptgrep.py path_to_your_data_export.zip "Your target message here"
- Case-Insensitive Search: Performs a case-insensitive search within messages.
- Direct Output: Outputs the titles and datestamp for all chats that contain the target message.
- Zip Extraction: Automatically extracts data from the exported
.zip
file without manual intervention.
$ ./gptgrep.py ~/Downloads/a8d0cee5d7853270947c973b3be9d96370cbe76cfd7e3dc26a2714bbcddca106-2023-08-21-13-36-46.zip "my future self"
chatgpt-grep:
- date: August 22, 2023 15:52:21
title: ChatGPT Grep
- date: August 21, 2023 09:51:02
title: Create Pull Request from Cloned Repo
To include additional context around matches, use the --context
option. This option allows you to specify the number of preceding (parent) and following (child) conversation nodes included in the output. Format the option as --context="prev,next"
, where prev
is the number of preceding parent nodes and next
is the number of following child nodes.
$ ./gptgrep.py --context="2,3" path_to_your_data_export.zip "Your target message here"
- Python 3
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. Ensure to update tests as appropriate.