Skip to content

Instantly share code, notes, and snippets.

@dot-mike
Last active August 21, 2026 21:52
Show Gist options
  • Select an option

  • Save dot-mike/28fa27db912530e69cb86a9b9742ebb4 to your computer and use it in GitHub Desktop.

Select an option

Save dot-mike/28fa27db912530e69cb86a9b9742ebb4 to your computer and use it in GitHub Desktop.
Claude Chat sharing. Useful for converting a chat from web to local llm parsing i.e claude code.

Fetch chat form claude chat web with curl. Replace UUID with real chat shareable ID.

curl -sL -A "Mozilla/5.0" -H "Accept: application/json" https://claude.ai/api/chat_snapshots/UUID -o snap.json

Use claude_share_dump.py to a chat UUID

#!/usr/bin/env python3
"""Dump a public claude.ai share link to markdown.
usage: claude_share_dump.py <share-url | uuid | saved-snapshot.json> [out.md]
"""
import json, os, re, subprocess, sys
UA = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 Chrome/126 Safari/537.36"
src = sys.argv[1]
if os.path.isfile(src):
d = json.load(open(src))
else:
uuid = re.search(r"[0-9a-f-]{36}", src).group(0)
url = f"https://claude.ai/api/chat_snapshots/{uuid}"
# ponytail: curl, not urllib — Cloudflare 403s python's TLS fingerprint; needs full browser UA
d = json.loads(subprocess.check_output(["curl", "-sfL", "-A", UA, "-H", "Accept: application/json", url]))
lines = [f"# {d['snapshot_name']}", ""]
for m in d["chat_messages"]:
text = m.get("text") or "".join(c.get("text", "") for c in m.get("content", []) if c.get("type") == "text")
lines += [f"## {m['sender'].upper()}", "", text, ""]
out = "\n".join(lines)
open(sys.argv[2], "w").write(out) if len(sys.argv) > 2 else print(out)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment