xfetch
БесплатноЗапускает вложенные скриптыНе проверенFetch and export public X (Twitter) data with a self-contained Python CLI (twikit; no API keys, uses the user's own login cookies): profiles, a user's…
от Agents365-ai★ 108 звёзд на GitHubОб этом скилле
xfetch
Fetch public data from X (Twitter) — profiles, tweets, threads, search, followers — using the user's own login cookies instead of the paid developer API. This skill ships a single self-contained CLI, scripts/xfetch.py, that calls X's GraphQL API directly and emits structured data an agent can parse.
How it stays working (the architecture that matters): the hard part of X scraping is that X constantly changes its site — it rotates GraphQL query IDs every few weeks, migrates endpoints between GET and POST, and reshapes response JSON. This CLI splits those concerns so a break in one place doesn't take everything down:
- It reuses the current query IDs and feature flags shipped by the twikit package (kept fresh with
pip install -U twikit) — so you don't hand-maintain the fastest-rotating values. - It does its own HTTP requests and JSON parsing, which sidesteps the two things most likely to be broken in twikit at any moment: (1) its homepage-scraped anti-bot transaction ID — this CLI sends a harmless placeholder
x-client-transaction-id, which X accepts for read endpoints; and (2) its response-model layer — this CLI parses the raw JSON itself. It also auto-falls-back GET↔POST on a 404, so an endpoint X migrates keeps working.
Net: if a command suddenly errors for everyone, the first fix is still pip install -U twikit (refreshes query IDs). If that doesn't help, X changed a response shape — check the parser in scripts/xfetch.py.
The agent-native contract
scripts/xfetch.py is built so you can drive it in a loop without surprises. Rely on these three channels rather than scraping prose:
stdoutcarries the data payload only (JSON by default). Redirect or pipe it — nothing else is written there.stderrcarries human status (✓ Saved…) and errors. Read it to diagnose; ignore it when parsing.- exit code is the truth signal:
0= success,1= error,2= not authenticated,3= rate limited (stderr carriesrate_limit_reset=<epoch>),64= usage error (bad flag or argument — fix the command, don't re-auth). Branch on the exit code, not on stderr text.
Setup (once per environment)
Confirm Python and install twikit (a virtualenv is cleanest so you don't touch system packages):
python3 -m pip install -r scripts/requirements.txt # installs twikit>=2.3.3Verify the CLI loads:
python3 scripts/xfetch.py --version # -> xfetch-skill 0.3
Invoke every command as python3 scripts/xfetch.py <command> … using this skill's own copy of the script.
Authenticate first — this is the #1 failure mode
Every data command needs the user's X cookies (auth_token + ct0). Without them the command prints Not authenticated. to stderr and exits 2. Auth is delegated: the human sets it up once, the CLI saves a session to ~/.config/xfetch/cookies.json, and you reuse it — you don't own the credential lifecycle, you just check it's present.
Always run this first and branch on the exit code:
python3 scripts/xfetch.py auth check
If it isn't authenticated, get the human to provide credentials, in order of preference:
Extract from a logged-in browser (most convenient — reads the x.com cookies straight from the browser's store, no copy/paste):
python3 scripts/xfetch.py auth extract --browser chrome # supported: chrome, chromium, firefox, safari, edge, brave, arc, opera, vivaldi, librewolfRequires
browser_cookie3(inrequirements.txt). On macOS this may prompt for Keychain access — that's the OS handing over the cookie-decryption key, which is expected.Import a cookies file (best for browsers without a reader — e.g. ChatGPT Atlas, Orion, or any Chromium fork): export cookies with a "Get cookies.txt" browser extension (Netscape
cookies.txtor JSON both work), then point the CLI at the file — it extractsauth_token+ct0for you:python3 scripts/xfetch.py auth import --file ~/Downloads/x.com_cookies.txtPaste cookie tokens (works for any browser): open DevTools → Application → Cookies →
https://x.com, copy theauth_tokenandct0values, then:python3 scripts/xfetch.py auth set --auth-token <token> --ct0 <token>Environment variables (good for CI / one-off, saves nothing to disk):
XFETCH_AUTH_TOKEN=<token> XFETCH_CT0=<token> python3 scripts/xfetch.py user @handleUsername/password login (twikit performs a real login; may trip a captcha or 2FA — pass
--totpfor TOTP-based 2FA):python3 scripts/xfetch.py auth login --username <user> --password <pass>
Never invent or guess cookie values. Prefer auth set/env over login so no password passes through the command line. If auth is missing and you can't obtain it, stop and ask the human — you cannot proceed without it. These read a real account, so
Установить xfetch в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл xfetch?
Fetch and export public X (Twitter) data with a self-contained Python CLI (twikit; no API keys, uses the user's own login cookies): profiles, a user's tweets/replies/likes, threads, search, followers, timelines, JSON/JSONL/CSV/SQLite output, resumable pagination. Use to scrape, archive, monitor, or analyze tweets or accounts.
Как установить скилл xfetch?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл xfetch запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic