Skip to content

Liyue2341/gemini-exporter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gemini Exporter

Batch-export your entire Google Gemini conversation history to individual JSON files.

中文说明 / Chinese README

Background

Most mainstream AI chatbots (ChatGPT, Claude, etc.) provide straightforward ways to bulk-export your conversation data. Google Gemini does not. The official Google Takeout export only gives you stripped-down prompt–response pairs with truncated content — far from a complete archive.

Browser extensions like AI Chat Exporter do an excellent job of exporting a single conversation with full fidelity (thanks to the developers!). But they require you to manually open and export each conversation one by one — not practical if you have hundreds of chats.

Gemini Exporter bridges this gap. It automates the entire workflow: scrolling through your sidebar to discover every conversation, then driving the AI Chat Exporter extension to select-all and export each one — fully unattended. The result is one JSON file per conversation, ready for backup, migration, or analysis.

How It Works

It uses Playwright to connect to your local Chrome via CDP, and the AI Chat Exporter extension to do the actual exporting:

  1. Phase 1 — Discover — Scrolls through the Gemini sidebar to collect all conversation links
  2. Phase 2 — Export — Opens each conversation, uses the extension to select all messages, and exports them as a JSON file

Each conversation is saved as gemini_export/{conversation_id}.json.

Prerequisites

  • Python 3.8+
  • Playwrightpip install playwright && playwright install chromium
  • Google Chrome
  • AI Chat Exporter extension installed in Chrome
  • A Google account logged into Gemini

Quick Start

1. Launch Chrome with remote debugging

# Windows
"C:\Program Files\Google\Chrome\Application\chrome.exe" --remote-debugging-port=9222

# macOS
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222

# Linux
google-chrome --remote-debugging-port=9222

2. Prepare Gemini

  • Open https://gemini.google.com/app in the Chrome window you just launched
  • Log in to your Google account
  • Expand the conversation sidebar (click the hamburger menu if collapsed)

3. Run the exporter

pip install -r requirements.txt
python gemini_exporter.py

That's it. The script will scroll through the sidebar, collect all conversation links, then export them one by one.

CLI Options

Flag Default Description
--cdp-port 9222 Chrome DevTools Protocol port
--output-dir gemini_export Directory to save exported JSON files
--timeout 120 Max seconds to wait per conversation
--no-confirm off Skip the "Press Enter" confirmation prompt
--only-id Only export a single conversation by ID
--no-skip off Re-export even if JSON file already exists

Examples:

# Use a different CDP port and output directory
python gemini_exporter.py --cdp-port 9223 --output-dir my_export

# Export a single conversation for testing
python gemini_exporter.py --only-id abc123def456 --no-confirm

# Re-export everything with a longer timeout
python gemini_exporter.py --timeout 180 --no-skip

Output

  • Exported files: gemini_export/{conversation_id}.json
  • Failed links: If any conversations fail to export, links are saved to gemini_export/failed_export_links_YYYYMMDD_HHMMSS.txt for manual retry.

Troubleshooting

Problem Solution
Cannot connect to localhost:9222 Make sure Chrome is running with --remote-debugging-port=9222. Don't open a second Chrome instance without this flag.
No conversations found Expand the sidebar manually before running the script. The script needs the sidebar visible to scroll and collect links.
Plugin buttons not detected Verify the AI Chat Exporter extension is installed and active. You should see SELECT / EXPORT buttons on Gemini conversation pages.
Conversation stuck / timeout Some pages (e.g. with Canvas) can hang. The script will automatically skip after the timeout and try to recover. Failed links are saved for manual retry.
Re-running the script By default, existing JSON files are skipped. This makes it safe to re-run and only export new or previously failed conversations.

Disclaimer

This tool is intended solely for exporting your own conversation data from Google Gemini. Users are responsible for complying with Google's Terms of Service. The authors are not responsible for any misuse of this tool.

License

MIT

About

Export your Google Gemini conversation history to individual JSON files

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages