Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

chatgpt-chat-export

БесплатноЗапускает вложенные скриптыНе проверен

Export a chatgpt.com (ChatGPT web) conversation to disk with full fidelity: raw backend-api JSON, all attachments (user-uploaded images, PDFs), and a readable…

vicnaumот vicnaum★ 53 звезды на GitHub

Об этом скилле

chatgpt-chat-export

ChatGPT's web UI has no full-fidelity export (Settings → Export mails a zip of everything, hours later). But the page itself talks to /backend-api/conversation/{id}, which returns the complete conversation as JSON — including edit branches, tool calls, reasoning scaffolding, and attachment references. This skill grabs that JSON plus every attachment from an authenticated Chrome session, and converts it to Markdown.

Output convention (one folder per conversation, named by UUID):

<project>/chat-exports/<conversation-uuid>/
├── conversation.json   ← raw /backend-api/conversation response, full fidelity
├── conversation.md     ← readable transcript (chatgpt2md.py)
├── FILES.md            ← attachment index: file id → name → local path
└── files/              ← binaries, by original filename

Workflow

Four stages: grab JSON → grab attachments → organize → convert. Two transport paths for the "grab" stages, depending on who drives the browser:

  • DevTools console (user runs snippets manually): Blob + <a download> clicks land in ~/Downloads. Simple, but Chrome blocks the 2nd+ programmatic download per tab — use a fresh tab per download, or bundle everything into one zip.
  • claude-in-chrome MCP (agent drives): a.click() downloads don't land on disk, javascript_tool results truncate at ~1000 chars, and the extension's DLP filter replaces JWT-shaped / base64 / query-string / long-uniform output with [BLOCKED: …]. Transport out via clipboard (primary — needs no network) or the bundled scripts/relay_server.py (blocked by uBlock's LAN-protection on some setups; see below).

Iron rule for the MCP path: never return the access token or a payload from javascript_tool. Stash everything in window.* and return only metadata (status, length, count).

1. Grab the conversation JSON

Conversation UUID comes from the URL: chatgpt.com/c/<uuid>. Open that page (logged in), then:

// In-page: token + conversation -> window.__conv. Returns only metadata.
const sess = await fetch('/api/auth/session').then(r => r.json());
window.__tok = sess.accessToken;
const CONV = '<conversation-uuid>';
window.__conv = await fetch('/backend-api/conversation/' + CONV,
  {headers: {Authorization: 'Bearer ' + window.__tok}}).then(r => r.json());
JSON.stringify({title: window.__conv.title, nodes: Object.keys(window.__conv.mapping || {}).length});

Transport — clipboard (MCP path). navigator.clipboard.writeText requires document focus and a user gesture, which javascript_tool doesn't have. Inject a full-page button and click it with the computer tool:

document.body.innerHTML = '<button id="copybtn" style="position:fixed;inset:0;width:100vw;height:100vh;font-size:40px">COPY</button><div id="st" style="position:fixed;bottom:0;left:0;background:#000;color:#0f0;padding:8px;z-index:9">waiting</div>';
window.__payload = JSON.stringify(window.__conv);
document.getElementById('copybtn').addEventListener('click', async () => {
  try { await navigator.clipboard.writeText(window.__payload);
        document.getElementById('st').textContent = 'COPIED ' + window.__payload.length; }
  catch (e) { document.getElementById('st').textContent = 'ERR ' + e.message; }
});
'ready';

Then: computer left_click anywhere on the page → verify via document.getElementById('st').textContent → on the shell side:

pbpaste > chat-exports/<uuid>/conversation.json
python3 -c "import json; d=json.load(open('chat-exports/<uuid>/conversation.json')); print(d['title'], len(d['mapping']))"

Clipboard handles ~10 MB fine. Clear it afterwards (printf '' | pbcopy) — and warn the user their clipboard was overwritten.

Transport — console download (manual path):

const blob = new Blob([JSON.stringify(window.__conv)], {type: 'application/json'});
const a = document.createElement('a'); a.href = URL.createObjectURL(blob);
a.download = 'conversation.json'; a.click();

2. Grab the attachments

Attachment references live in two places in the JSON:

  • mapping[*].message.metadata.attachments[] → {id, name, mime_type, size} (user uploads: images, PDFs)
  • image parts' content.parts[*].asset_pointer → sediment://file_… (same files, by pointer)

Resolve each id to a download URL in-page:

GET /backend-api/conversation/{conv-id}/attachment/{file-id}/download   (Bearer auth)
→ {download_url, file_name, mime_type, file_size_bytes}

The download_url is NOT a signed CDN link — it's chatgpt.com/backend-api/estuary/content?id=…, which needs the browser's auth. curl from outside fails (exit 56). So fetch the bytes in-page and bundle them:

// window.__files = [{id, name}] built from window.__conv (dedupe by id first)
const toB64 = (blob) => new Promise((res, rej) => {
  const fr = new FileReader();
  fr.onload = () => res(fr.result.split(',')[1]); fr.onerror = rej;
  fr.readAsDataURL(blob);
});
const CONV = '<conversation-uuid>';
const b
Полный SKILL.md на GitHub

Установить chatgpt-chat-export в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

scripts/chatgpt2md.pyscripts/relay_server.pyscripts/unpack_clipboard.py

FAQ

Что делает скилл chatgpt-chat-export?

Export a chatgpt.com (ChatGPT web) conversation to disk with full fidelity: raw backend-api JSON, all attachments (user-uploaded images, PDFs), and a readable Markdown transcript. Use when the user wants to: (1) grab/download/archive a ChatGPT talk locally, (2) pull a chatgpt.com conversation's JSON via the API route, (3) download the images/PDFs attached to a ChatGPT chat, (4) convert a ChatGPT conversation to Markdown, or (5) feed a ChatGPT conversation into another tool/agent. Triggers on chatgpt.com URLs (/c/<uuid>), 'grab this talk', 'export this ChatGPT chat', 'ChatGPT conversation JSON', or ChatGPT attachment downloads.

Как установить скилл chatgpt-chat-export?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл chatgpt-chat-export запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить chatgpt-chat-export с