Export Grok conversations in two stages.
Stage 1 — Capture conversation JSON from X/Grok
Run the browser script in Chrome DevTools Console on https://x.com/i/grok while logged in.
Use script: INLINECODE1
Behavior:
- - Intercept only
GrokConversationItemsByRestId responses (fetch + XHR) - Load chat history with multi-pass scrolling
- Open each discovered conversation to trigger backend responses
- Save one JSON file with conversation metadata + ordered item payload
Quick settings (edit at top of script before run):
- -
INDEX_PASSES (default 3) - INLINECODE7 (default
3) - INLINECODE9 (
null = all, or number for test)
Output:
- -
grok-network-capture-<timestamp>.json downloaded by browser
Stage 2 — Convert JSON to Obsidian Markdown
Run Python converter locally:
CODEBLOCK0
Converter defaults:
- - Frontmatter fields:
URL, INLINECODE13 - Body starts immediately with
# <title> (no blank line before header) - Turn headings:
## User / ## Grok (no numbering) - Turn separator: INLINECODE17
- Turn order: reverse API item order (API is newest-first)
- Reasoning/deepsearch omitted by default
Useful flags:
- -
--include-reasoning include thinking_trace blocks - INLINECODE20 customize turn separator
- INLINECODE21 overwrite same-title files instead of creating INLINECODE22
Notes
- - Prefer several index/capture passes because X history rendering is lazy and inconsistent.
- If discovered chat count is unexpectedly low, re-run Stage 1 with higher pass counts.
- Keep scripts generic; avoid user-specific absolute paths.
技能名称:x-grok-to-obsidian
详细描述:
分两个阶段导出Grok对话。
第一阶段 — 从X/Grok捕获对话JSON
在登录状态下,于Chrome DevTools控制台中运行浏览器脚本(网址为https://x.com/i/grok)。
使用脚本:scripts/exportgrokitems_capture.js
行为:
- - 仅拦截GrokConversationItemsByRestId响应(fetch + XHR)
- 通过多轮滚动加载聊天历史
- 打开每个已发现的对话以触发后端响应
- 保存一个包含对话元数据及有序条目负载的JSON文件
快速设置(运行前在脚本顶部编辑):
- - INDEXPASSES(默认3)
- CAPTUREPASSES(默认3)
- MAX_CHATS(null表示全部,或输入数字用于测试)
输出:
- - 浏览器下载grok-network-capture-.json文件
第二阶段 — 将JSON转换为Obsidian Markdown
在本地运行Python转换器:
bash
python3 scripts/convertgrokcapturetomd.py \
--input /path/to/grok-network-capture-*.json \
--out /path/to/output-folder
转换器默认设置:
- - 前置元数据字段:URL、created
- 正文以# <标题>直接开始(标题前无空行)
- 对话轮次标题:## User / ## Grok(无编号)
- 对话轮次分隔符:---
- 对话轮次顺序:反转API条目顺序(API默认最新在前)
- 默认省略推理/深度搜索内容
实用参数:
- - --include-reasoning 包含thinking_trace块
- --separator --- 自定义对话轮次分隔符
- --overwrite 覆盖同名文件,而非创建标题 2.md
注意事项
- - 建议执行多次索引/捕获轮次,因为X的历史记录渲染存在延迟且不一致。
- 若发现的聊天数量异常偏少,请使用更高的轮次重新运行第一阶段。
- 保持脚本通用性;避免使用用户特定的绝对路径。