Skip to content
Back to search

x-fetcher

SkillWorks with Claude CodeGitHub

抓取 X (Twitter) 帖子 + 微信公众号文章。X 支持普通推文 / X Article 长文章 / 互动数据,微信支持公众号文章正文+作者+字数。触发词:x.com、twitter.com、X 链接、推文、X Article、mp.weixin.qq.com、微信文章、公众号链接、抓取公众号

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/jane-xiaoer--x-fetcher/badge.svg)](/listings/jane-xiaoer--x-fetcher)

HTML

<a href="/listings/jane-xiaoer--x-fetcher"><img src="/api/listings/jane-xiaoer--x-fetcher/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

作为 Claude Code Skill(推荐)

git clone https://github.com/Jane-xiaoer/x-fetcher.git ~/.claude/skills/x-fetcher
cd ~/.claude/skills/x-fetcher
pip install -r requirements.txt

装完后,在 Claude Code 里直接扔链接,CC 自动识别平台 + 调对应脚本:

> 抓一下这个 https://x.com/elonmusk/status/123456789 > 抓这篇微信文章 https://mp.weixin.qq.com/s/abc123

作为命令行工具

git clone https://github.com/Jane-xiaoer/x-fetcher.git
cd x-fetcher
pip install -r requirements.txt

---

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

SKILL.md · Manifest · 51 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. ---
  2. name: x-fetcher
  3. description: 抓取 X (Twitter) 帖子 + 微信公众号文章。X 支持普通推文 / X Article 长文章 / 互动数据,微信支持公众号文章正文+作者+字数。触发词:x.com、twitter.com、X 链接、推文、X Article、mp.weixin.qq.com、微信文章、公众号链接、抓取公众号
  4. ---
  5. # x-fetcher v2 — 双能力内容抓取器
  6. **装一个 skill,抓两个平台**:X (Twitter) + 微信公众号文章。
  7. ## 触发场景
  8. 只要用户消息里出现以下任一,自动调用本 skill:
  9. | 平台 | URL 特征 | 用哪个脚本 |
  10. |---|---|---|
  11. | X / Twitter | `x.com/*/status/*` 或 `twitter.com/*/status/*` | `python fetch_x.py <url>` |
  12. | 微信公众号 | `mp.weixin.qq.com/s/*` | `python fetch_wechat.py <url>` |
  13. ## 核心命令
  14. ### X / Twitter
  15. ```bash
  16. python fetch_x.py <x_url> [选项]
  17. ```
  18. 选项:`--save-md` / `--with-replies` / `--full` / `--json` / **`--save-video`**(🆕 下载推文视频)
  19. 详见根目录 README 的"X 抓取"段。
  20. ### 微信公众号
  21. ```bash
  22. python fetch_wechat.py <wechat_url>
  23. ```
  24. 输出:标题 + 作者 + 字数 + 正文(纯文本)。
  25. ## 执行流程
  26. 1. 识别 URL 平台(x.com / twitter.com / mp.weixin.qq.com)
  27. 2. 调对应脚本
  28. 3. 解析输出
  29. 4. 直接交付给用户,或继续下游处理(翻译 / 摘要 / 发布 / 归档)
  30. ## 注意
  31. - 仅适用于公开内容(私密账号 / 需登录文章无法抓取)
  32. - 微信链接有效期通常较长,极少数旧文章可能失效
  33. - 依赖 Python `requests` 库(已在 requirements.txt)
  34. - 跨平台 SSL:微信抓取用 Python `requests`(自动处理证书),不需要 macOS 上 curl `-k` 的 hack
README.md · README · 211 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. # x-fetcher v2
  2. **装一个 skill,抓两个平台**:X (Twitter) + 微信公众号文章。
  3. > v2 升级(2026-04-29):合并 wechat-fetcher 能力,新增微信公众号文章抓取。
  4. > Claude Code skill 自动触发(放进 `~/.claude/skills/` 即可,扔链接给 CC 自动识别 + 抓)。
  5. ## 安装
  6. ### 作为 Claude Code Skill(推荐)
  7. ```bash
  8. git clone https://github.com/Jane-xiaoer/x-fetcher.git ~/.claude/skills/x-fetcher
  9. cd ~/.claude/skills/x-fetcher
  10. pip install -r requirements.txt
  11. ```
  12. 装完后,在 Claude Code 里直接扔链接,CC 自动识别平台 + 调对应脚本:
  13. > 抓一下这个 https://x.com/elonmusk/status/123456789
  14. > 抓这篇微信文章 https://mp.weixin.qq.com/s/abc123
  15. ### 作为命令行工具
  16. ```bash
  17. git clone https://github.com/Jane-xiaoer/x-fetcher.git
  18. cd x-fetcher
  19. pip install -r requirements.txt
  20. ```
  21. ---
  22. ## 使用
  23. ### 一、抓 X (Twitter) 帖子
  24. ```bash
  25. python fetch_x.py <x_url> [选项]
  26. ```
  27. #### 选项
  28. | 选项 | 说明 |
  29. |------|------|
  30. | `--save-md` | 直接保存主贴为 Markdown |
  31. | `--with-replies` | 同时抓取评论 |
  32. | `--full` | 保存完整归档(主贴+评论) |
  33. | `--json` | 仅输出 JSON,不保存文件 |
  34. | `--save-video` 🆕 | 下载推文里的视频/媒体到当前目录(可与其它选项叠加) |
  35. #### 示例
  36. ```bash
  37. # 交互模式(推荐)— 会询问你要保存哪些内容
  38. python fetch_x.py "https://x.com/elonmusk/status/123456789"
  39. # 抓取 X Article 长文章
  40. python fetch_x.py "https://x.com/thedankoe/status/2010751592346030461"
  41. # 直接保存主贴为 Markdown
  42. python fetch_x.py "https://x.com/elonmusk/status/123456789" --save-md
  43. # 保存完整归档(主贴 + 评论)
  44. python fetch_x.py "https://x.com/elonmusk/status/123456789" --full
  45. # 仅输出 JSON
  46. python fetch_x.py "https://x.com/elonmusk/status/123456789" --json --with-replies
  47. # 🆕 下载推文里的视频(以 {username}_{tweet_id}_video_N.mp4 命名)
  48. python fetch_x.py "https://x.com/zeke/status/2049348208489570771" --save-video
  49. # 视频 + 评论 + 完整归档,叠加用
  50. python fetch_x.py "https://x.com/elonmusk/status/123456789" --full --save-video
  51. ```
  52. #### 交互模式菜单
  53. ```
  54. 📋 抓取成功!请选择要保存的内容:
  55. ==================================================
  56. [1] 仅保存主贴内容
  57. [2] 仅保存评论/回复
  58. [3] 保存主贴 + 评论(完整归档)
  59. [4] 仅输出 JSON(不保存文件)
  60. [0] 退出
  61. ```
  62. #### 生成文件命名
  63. `{用户名}_{推文ID}_{类型}_{时间戳}.md`
  64. - `_post_` — 仅主贴
  65. - `_replies_` — 仅评论
  66. - `_full_` — 完整归档
  67. #### X 输出格式
  68. **普通推文**:
  69. ```json
  70. {
  71. "source": "fxtwitter",
  72. "success": true,
  73. "type": "tweet",
  74. "content": {
  75. "text": "推文内容...",
  76. "author": "作者名",
  77. "username": "用户名",
  78. "created_at": "发布时间",
  79. "likes": 1234,
  80. "retweets": 567,
  81. "views": 89000,
  82. "media": ["图片/视频URL"],
  83. "replies": 123
  84. }
  85. }
  86. ```
  87. **X Article 长文章**:
  88. ```json
  89. {
  90. "source": "fxtwitter",
  91. "success": true,
  92. "type": "article",
  93. "content": {
  94. "title": "文章标题",
  95. "preview": "文章预览...",
  96. "full_text": "完整文章内容(Markdown 格式)...",
  97. "cover_image": "封面图URL",
  98. "author": "作者名",
  99. "username": "用户名",
  100. "created_at": "创建时间",
  101. "modified_at": "修改时间",
  102. "likes": 206351,
  103. "retweets": 28631,
  104. "views": 115555283,
  105. "bookmarks": 571495
  106. }
  107. }
  108. ```
  109. ---
  110. ### 二、抓微信公众号文章 🆕(v2 新增)
  111. ```bash
  112. python fetch_wechat.py <wechat_url>
  113. ```
  114. #### 示例
  115. ```bash
  116. python fetch_wechat.py "https://mp.weixin.qq.com/s/abc123"
  117. ```
  118. #### 输出
  119. ```
  120. 【标题】xxx
  121. 【作者】xxx
  122. 【字数】xxx 字
  123. 【正文】
  124. 完整正文(纯文本,段落保留)
  125. ```
  126. #### 工作原理
  127. - **UA 伪装法**:用微信内置浏览器 UA 直接 HTTP GET,无需 Cookie / 代理 / 登录
  128. - **跨平台 SSL**:用 Python `requests`(自动处理证书),先严格验证,失败回退跳过验证。**比 curl `-k` 跨平台稳**
  129. - 纯正则解析(从 `#js_content` 提取),无额外依赖
  130. ---
  131. ## 支持的 URL 格式
  132. ### X
  133. - `https://x.com/username/status/123456789`
  134. - `https://twitter.com/username/status/123456789`
  135. ### 微信公众号
  136. - `https://mp.weixin.qq.com/s/<id>`
  137. - `https://mp.weixin.qq.com/s?__biz=...&mid=...&idx=...`(扩展格式)
  138. ## 限制
  139. - 依赖第三方 API(fxtwitter)抓 X,可能因服务变更而失效
  140. - 私密账号的内容 / 需登录的微信付费文章无法抓取
  141. - 部分媒体内容可能无法获取完整 URL
  142. ## License
  143. MIT
  144. ---
  145. ## 📱 关注作者 / Follow Me
  146. 如果这个仓库对你有帮助,欢迎关注我。后面我会持续更新更多 AI Skill、X/Twitter 工具、微信文章工作流和内容抓取自动化。
  147. If this repo helped you, follow me for more AI skills, X/Twitter tools, WeChat workflows, content scraping, and automation ideas.
  148. - X (Twitter): [@xiaoerzhan](https://x.com/xiaoerzhan)
  149. - 微信公众号 / WeChat Official Account: 扫码关注 / Scan to follow
  150. <p align="center">
  151. <img src="./follow-wechat-qrcode.jpg" alt="Jane WeChat Official Account QR code" width="300" />
  152. </p>
  153. <p align="center"><strong>中文:</strong>欢迎关注我的公众号,一起研究 AI Skill、推文抓取、微信文章工作流和内容自动化实践。</p>
  154. <p align="center"><strong>English:</strong> Follow my WeChat Official Account for more AI skills, X/Twitter scraping tools, WeChat content workflows, and automation ideas.</p>

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.