mcpField
X
x-tweet-fetcher

x-tweet-fetcher

github.com/ythx-101Data & databases994454 installsUpdated 2w ago
Repository

About x-tweet-fetcher

A CLI and Python library for fetching public X/Twitter content, including tweets, timelines, searches, and mentions. It supports multiple backends, with some tasks requiring Nitter or a browser.

Key features

  1. 01Fetch single tweets and user profiles
  2. 02Retrieve replies and user timelines
  3. 03Search posts and monitor mentions
  4. 04Read X Lists and Articles
  5. 05Route requests across Nitter and browser backends

Use cases

  1. 01Collect a tweet’s text, author, metrics, and media URLs
  2. 02Review a user’s timeline or search for posts
  3. 03Track new mentions of an account
  4. 04Fetch content from X Lists or Articles

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/ythx-101/x-tweet-fetcher --skill x-tweet-fetcher

After installing, type/x-tweet-fetcherin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

.gitignore
pyproject.toml
LICENSE
MIGRATION.md
CHANGELOG.md
VERSION
README.md
.github/workflows/
ci.yml
docs/
e2e-integration.md
scripts/
fetch_tweet.py
src/xtf/
__init__.py
cli.py
config.py
exceptions.py
http.py
i18n.py
ledger.py
monitor.py
models.py
src/xtf/backends/
__init__.py
base.py
_camofox_driver.py
_playwright_driver.py
browser.py
nitter.py
fxtwitter.py
src/xtf/parsers/
__init__.py
fxtwitter_json.py
nitter_html.py
urls.py

Details

From the project README

X Tweet Fetcher

Fetch tweets from X/Twitter without authentication. For agent-use stories, failures, and field reports, start from #22 Teahouse / 茶座.

Feature Overview

FeatureCommandDependencies
Single tweetxtf --url <tweet_url>None (zero deps)
Reply threadsxtf --url <tweet_url> --repliesNitter or browser
User timelinextf --user <username> --limit 50Nitter or browser
Searchxtf --search "<query>"Nitter
User profilextf --user-info <username>None (zero deps)
X Listxtf --list <list_url_or_id>Browser (Camofox/Playwright)
X Articlextf --article <url_or_id>Browser (Camofox/Playwright)
Mentions monitorxtf --monitor @<username>Nitter or browser

python3 scripts/fetch_tweet.py accepts the same flags (v1-compatible entry point).

Basic Usage (Zero Dependencies)

# JSON output (default)
xtf --url https://x.com/user/status/1234567890

# Human-readable
xtf --url https://x.com/user/status/1234567890 --text-only

# Output covers: text, author, stats (likes/retweets/views), media URLs,
# quoted tweets, and full article text for tweet-embedded articles.

Timeline / Search / Replies (Nitter)

export XTF_NITTER=http://127.0.0.1:8788   # your instance; comma-separate for failover
xtf --user elonmusk --limit 20
xtf --search "openclaw" --limit 10
xtf --url https://x.com/user/status/123 --replies

Backend selection: --backend auto (default, Nitter first then browser), --backend nitter, --backend browser.

Lists & Articles (Browser)

# Camofox running on localhost:9377 (default), or:
export XTF_BROWSER=playwright

xtf --list https://x.com/i/lists/1455045069516357634 --limit 30
xtf --article https://x.com/i/article/2011779830157557760

Note: full X Article text requires X login; without it you get title + public preview (is_partial: true).

Mentions Monitor (cron-friendly)

xtf --monitor @yourhandle
# exit 0 = no new mentions, 1 = new mentions found, 2 = setup error
# First run builds a baseline silently; later runs report only new URLs.

Error Handling for Agents

Every error result includes error (message) and error_code: invalid_input · not_found · rate_limited · upstream_down · backend_unavailable · all_backends_failed (with per-backend error_causes).

Python API

from xtf import Router
router = Router()
tweets = router.fetch_timeline("elonmusk", limit=20)  # list[Tweet]
print(tweets[0].to_dict())

Directory Structure

src/xtf/
├── backends/   # fxtwitter.py, nitter.py, browser.py
├── parsers/    # pure parsing functions, fixture-tested
├── router.py   # auto-fallback
├── monitor.py  # mentions monitor
└── cli.py      # the `xtf` command
scripts/fetch_tweet.py  # v1-compatible shim

Looking for Chinese-platform fetching (Weibo/Bilibili/WeChat) or tweet growth tracking? Those moved out of this repo in v2 — see MIGRATION.md.

Comments

Markdown supported