X Thread Reader
Fetch full text or generate a PDF from any X/Twitter thread via twitter-thread.com.
How It Works
Text mode: curl the twitter-thread.com /pdf/{tweet_id} page. The full article is embedded in the HTML <meta name="description"> tag — no browser or JS rendering needed. Fast, reliable, zero dependencies beyond curl and python3.
PDF mode: Uses Chrome headless (--print-to-pdf) or agent-browser to render and save the PDF. Browser required because the PDF generation page uses JS.
Limitations
- - Requires the thread to be indexed on twitter-thread.com — if not indexed, visit the thread URL in a browser first to trigger indexing
- Does NOT work for X Articles (
x.com/i/article/...) — those require a logged-in browser - Does NOT work for protected/private accounts or deleted tweets
Quick Usage
Get full thread text
CODEBLOCK0
Download PDF
CODEBLOCK1
Accepts full X/Twitter URL or raw tweet ID.
Output Format
The text mode outputs structured content:
- - Author and date from the thread
- Full article text — complete thread content, all tweets concatenated
- Source URL for citation
Suitable for archiving to Obsidian, note-taking apps, or further analysis.
Gotchas
- - The
/pdf/{id} URL returns HTML (not a PDF) — the article is in the <meta name="description"> tag, extracted via python3. If twitter-thread.com changes their HTML structure, this extraction breaks silently (empty output). - Thread must be indexed on twitter-thread.com first. Fresh threads (< 30 min old) may not be available yet. The
/t/{id} page triggers indexing when visited in a browser. - macOS grep does not support
-P (PCRE). All grep patterns in the script use -oE (extended regex) for portability. - Very long threads may truncate in the meta description. If output seems incomplete, compare against the PDF version.
- The script extracts from the first
<meta name="description"> match — if the page structure adds multiple, it may grab the wrong one.
Troubleshooting
"Thread not found" error:
The thread is not yet indexed on twitter-thread.com. Visit https://twitter-thread.com/t/{tweet_id} in a browser to trigger indexing, wait ~30s, then retry.
Empty article text:
twitter-thread.com may have changed their HTML structure. Check if the <meta name="description"> tag still contains the article content.
X Article links (x.com/i/article/...):
These are NOT threads. They require a logged-in browser session and cannot be fetched with this skill.
Protected/deleted tweets:
The skill cannot access tweets from private accounts or tweets that have been deleted.
X Thread Reader
通过 twitter-thread.com 获取任意 X/Twitter 帖子的全文或生成 PDF。
工作原理
文本模式: 使用 curl 请求 twitter-thread.com 的 /pdf/{tweet_id} 页面。完整文章嵌入在 HTML 的 标签中——无需浏览器或 JS 渲染。快速、可靠,除 curl 和 python3 外无需其他依赖。
PDF 模式: 使用 Chrome 无头模式(--print-to-pdf)或 agent-browser 渲染并保存 PDF。需要浏览器是因为 PDF 生成页面使用了 JS。
限制
- - 要求帖子已在 twitter-thread.com 上建立索引——若未索引,请先在浏览器中访问帖子 URL 以触发索引
- 不适用于 X 文章(x.com/i/article/...)——这些需要登录浏览器
- 不适用于受保护/私密账户或已删除的推文
快速使用
获取完整帖子文本
bash
scripts/x_thread.sh text https://x.com/user/status/1234567890
下载 PDF
bash
scripts/x_thread.sh pdf https://x.com/user/status/1234567890
自定义输出路径:
scripts/x_thread.sh pdf https://x.com/user/status/1234567890 /tmp/my-thread.pdf
接受完整的 X/Twitter URL 或原始推文 ID。
输出格式
文本模式输出结构化内容:
- - 帖子的作者和日期
- 完整文章文本——完整的帖子内容,所有推文拼接而成
- 用于引用的来源 URL
适合归档到 Obsidian、笔记应用或进一步分析。
注意事项
- - /pdf/{id} URL 返回的是 HTML(而非 PDF)——文章位于 标签中,通过 python3 提取。如果 twitter-thread.com 更改了其 HTML 结构,此提取将静默失败(输出为空)。
- 帖子必须先在 twitter-thread.com 上建立索引。新帖子(发布不到 30 分钟)可能尚不可用。在浏览器中访问 /t/{id} 页面会触发索引。
- macOS 的 grep 不支持 -P(PCRE)。脚本中的所有 grep 模式均使用 -oE(扩展正则表达式)以确保可移植性。
- 非常长的帖子可能在 meta 描述中被截断。如果输出似乎不完整,请与 PDF 版本进行对比。
- 脚本提取第一个 匹配项——如果页面结构添加了多个,可能会抓取错误的那个。
故障排除
未找到帖子错误:
该帖子尚未在 twitter-thread.com 上建立索引。在浏览器中访问 https://twitter-thread.com/t/{tweet_id} 以触发索引,等待约 30 秒后重试。
文章文本为空:
twitter-thread.com 可能已更改其 HTML 结构。检查 标签是否仍包含文章内容。
X 文章链接(x.com/i/article/...):
这些不是帖子。它们需要登录的浏览器会话,无法使用此技能获取。
受保护/已删除的推文:
该技能无法访问私密账户的推文或已被删除的推文。