使用 Chrome CDP 将 ChatGPT.com 和 Claude.ai 的分享链接提取并归档为 Markdown 文件(如对话内容)。
Extracts and archives chatgpt.com and claude.ai share links to Markdown using Chrome DevTools Protocol.
User message contains:
Keywords: 提取 chatgpt, 提取 claude, 提取文档, 提取 chatgpt 对话, 提取 claude 对话, 归档 chatgpt 对话, 归档 claude 对话, 保存 chatgpt 对话, 保存 claude 对话, extract chatgpt, extract claude, archive chatgpt, archive claude, save chatgpt, save claude
Links:
https://chatgpt.com/share/{share-id}https://claude.ai/share/{share-id}bash
# Copy script to PATH
cp {baseDir}/scripts/extract.sh /usr/local/bin/
chmod +x /usr/local/bin/extract.sh
# Run
extract.sh "https://chatgpt.com/share/xxx"
extract.sh "https://claude.ai/share/xxx"
bash
# 1. Capture HTML
cd {baseDir}/scripts
CHROME_DEBUG_PORT=9222 TARGET_URL="https://chatgpt.com/share/xxx" \
node capture-cdp.js
# 2. Convert to Markdown (use output path from step 1)
node convert-markdown.js --metadata "~/LookBack/$(date +%Y-%m-%d)/ChatGPT/.metadata.json"
VariableDescriptionDefaultCHROME_DEBUG_PORTChrome debugging port9222``TARGET_URLShare link URL(required)OUTPUT_DIROutput directory~/LookBack/{date}/{ChatGPT|Claude}
text
~/LookBack/{YYYY-MM-DD}/
├── ChatGPT/
│ ├── {title}-{timestamp}.md # Markdown file
│ ├── {title}-{timestamp}-captured.html # HTML snapshot
│ └── .metadata.json # Metadata
└── Claude/
└── ...
Chrome Debug Mode: Start Chrome with --remote-debugging-port=9222
bash
# macOS
open -a "Google Chrome" --args --remote-debugging-port=9222
# Linux
google-chrome --remote-debugging-port=9222
Install Dependencies: bash
npm install -g ws
ErrorCauseSolutionConnection refusedChrome debug port not openStart Chrome with --remote-debugging-portTimeoutPage loading slowIncrease wait time or refresh manuallyTarget not foundInvalid linkVerify the share link is correct
ScriptDescriptioncapture-cdp.jsCDP capture script, extracts HTMLconvert-markdown.jsHTML to Markdown converterextract.shOne-click entry script