mcpField
X
x-tweet-fetcher

x-tweet-fetcher

github.com/ythx-101データ・データベース994454 回インストール2 週間前に更新
リポジトリ

x-tweet-fetcher について

公開されている X/Twitter の投稿を取得するコマンドラインツール兼 Python ライブラリです。投稿、タイムライン、検索、メンション監視に対応し、一部の処理には Nitter またはブラウザーが必要です。

主な機能

  1. 01単一の投稿とユーザープロフィールの取得
  2. 02返信スレッドとユーザータイムラインの取得
  3. 03投稿の検索とメンション監視
  4. 04X リストと記事の取得
  5. 05Nitter とブラウザーバックエンド間のルーティング

活用シーン

  1. 01投稿本文、投稿者、指標、メディア URL の収集
  2. 02ユーザーのタイムライン確認や投稿検索
  3. 03アカウントへの新しいメンションの追跡
  4. 04X リストや記事の内容の取得

インストール

コマンドをコピーしてターミナルで実行します。

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

インストール後、Claude Code で/x-tweet-fetcherを入力して読み込まれたか確認します。

同梱ファイル

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

詳細

X ツイート取得ツール

認証なしで X/Twitter からツイートを取得します。エージェントの活用事例、失敗、現場からの報告については、#22 茶座 / Teahouse をご覧ください。

機能概要

機能コマンド依存関係
単一のツイートxtf --url <tweet_url>なし(依存関係ゼロ)
返信スレッドxtf --url <tweet_url> --repliesNitter またはブラウザー
ユーザーのタイムラインxtf --user <username> --limit 50Nitter またはブラウザー
検索xtf --search "<query>"Nitter
ユーザープロフィールxtf --user-info <username>なし(依存関係ゼロ)
X リストxtf --list <list_url_or_id>ブラウザー(Camofox/Playwright)
X 記事xtf --article <url_or_id>ブラウザー(Camofox/Playwright)
メンションの監視xtf --monitor @<username>Nitter またはブラウザー

python3 scripts/fetch_tweet.py も同じフラグを受け付けます(v1 互換のエントリーポイント)。

基本的な使い方(依存関係ゼロ)

# 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.

タイムライン/検索/返信(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 auto(デフォルト。まず Nitter を使用し、その後ブラウザーを使用)、--backend nitter、--backend 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

注:X 記事の全文を取得するには X へのログインが必要です。ログインしていない場合は、タイトルと公開プレビューが取得されます(is_partial: true)。

メンションの監視(cron 対応)

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(メッセージ)と error_code が含まれます: invalid_input · not_found · rate_limited · upstream_down · backend_unavailable · all_backends_failed(バックエンドごとの error_causes を含みます)。

Python API

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

ディレクトリー構成

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

中国のプラットフォーム(Weibo/Bilibili/WeChat)からの取得や、ツイートの成長追跡をお探しですか? これらは v2 でこのリポジトリーから移動しました。MIGRATION.md をご覧ください。

コメント