X Tweet Fetcher
Fetch tweets from X/Twitter without authentication. Uses FxTwitter API.
What It Can Fetch
| Content Type | Support |
|---|
| Regular tweets | ✅ Full text + stats |
| Long tweets (Twitter Blue) |
✅ Full text |
| X Articles (long-form) | ✅ Complete article text |
| Quoted tweets | ✅ Included |
| Stats (likes/RT/views) | ✅ Included |
Usage
CLI
CODEBLOCK0
From Agent Code
CODEBLOCK1
Output Format
CODEBLOCK2
Requirements
- - Python 3.7+
- No external packages (stdlib only)
- No API keys
- No login required
How It Works
Uses FxTwitter public API (api.fxtwitter.com) which proxies X/Twitter content. Articles are returned as structured blocks and reassembled into full text.
Limitations
- - Cannot fetch reply threads (only reply counts available via
replies_count field)
- Reply content would require browser automation dependencies (Camofox/Nitter)
- These were removed to maintain zero-dependency architecture
-
--replies flag exists but returns an explanatory error message
- - Cannot fetch deleted or private tweets
- Rate limits depend on FxTwitter service availability
- If FxTwitter goes down, the skill won't work (no fallback)
File Structure
CODEBLOCK3
X Tweet 获取器
无需认证即可从X/Twitter获取推文。使用FxTwitter API。
可获取内容
| 内容类型 | 支持情况 |
|---|
| 普通推文 | ✅ 完整文本 + 统计数据 |
| 长推文(Twitter Blue) |
✅ 完整文本 |
| X文章(长文) | ✅ 完整文章文本 |
| 引用推文 | ✅ 包含 |
| 统计数据(点赞/转发/浏览) | ✅ 包含 |
使用方法
命令行
bash
JSON输出
python3 scripts/fetch_tweet.py --url https://x.com/user/status/123456
美化JSON
python3 scripts/fetch_tweet.py --url https://x.com/user/status/123456 --pretty
仅文本(人类可读)
python3 scripts/fetch_tweet.py --url https://x.com/user/status/123456 --text-only
在Agent代码中使用
python
from scripts.fetchtweet import fetchtweet
result = fetch_tweet(https://x.com/user/status/123456)
tweet = result[tweet]
普通推文
print(tweet[text])
X文章(长文)
if tweet[is_article]:
print(tweet[article][title])
print(tweet[article][full_text]) # 完整文章
print(tweet[article][word_count])
输出格式
json
{
url: https://x.com/user/status/123,
username: user,
tweet_id: 123,
tweet: {
text: 推文内容...,
author: 显示名称,
screen_name: 用户名,
likes: 100,
retweets: 50,
bookmarks: 25,
views: 10000,
replies_count: 30,
created_at: Mon Jan 01 12:00:00 +0000 2026,
isnotetweet: false,
is_article: true,
article: {
title: 文章标题,
full_text: 完整文章内容...,
word_count: 4847,
char_count: 27705
}
}
}
系统要求
- - Python 3.7+
- 无外部包依赖(仅使用标准库)
- 无需API密钥
- 无需登录
工作原理
使用FxTwitter公共API(api.fxtwitter.com),该API代理X/Twitter内容。文章以结构化块的形式返回,并重新组装为完整文本。
局限性
- - 无法获取回复线程(仅可通过replies_count字段获取回复数量)
- 回复内容需要浏览器自动化依赖(Camofox/Nitter)
- 已移除这些依赖以保持零依赖架构
- --replies标志存在但返回解释性错误信息
- - 无法获取已删除或私密推文
- 速率限制取决于FxTwitter服务的可用性
- 如果FxTwitter服务不可用,该技能将无法工作(无备用方案)
文件结构
skills/x-tweet-fetcher/
├── SKILL.md (本文件)
└── scripts/
└── fetch_tweet.py (单文件,零依赖)