Logo vun Xfetch

Xfetch

Communautéit
Agents365-ai
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.

Iwwersiicht

EditeurAgents365-ai
Repository365-skills
Skill-Nummxfetch
Stären
99
Forks
16
Matgeliwwert Fichieren
3
LizenzMIT
Linken
  • Instruktiounen am Markdown-Format

    Eng SKILL.md-Datei, déi de Modell bei Bedarf luet, soudatt nëmmen Token ufalen, wann eng Ufro tatsächlech dozou passt.

  • Funktionéiert mat all LLM

    KI-Skills si reng Markdown, keen ubidderspezifesche Code. Dofir funktionéiert dëse Skill mat GPT, Claude, Gemini, Grok oder engem lokale Modell.

  • 3 matgeliwwert Dateien

    Skripten, Virlagen a Referenzen, déi de Modell beim Schaffe liese kann. D'Dateie kënnen nëmme gelies ginn a ginn ni ausgeféiert.

  • Open Source

    Vum Agents365-ai op GitHub verëffentlecht. Liest de Quelltext, ier Dir de Skill installéiert.

Installatioun

Installéiert de KI-Skill Xfetch an TypingMind, fir e mat all LLM ze benotzen, oder füügt en an en anere KI-Agent an, deen SKILL.md liest.

1

An TypingMind installéieren

TypingMind installéiert e Skill direkt aus sengem GitHub-Dossier — dobäi gëtt SKILL.md gelies, d'Ressourcedateie gi gebëndelt an d'Resultat gëtt lokal gespäichert.

  1. Maacht d'App op a gitt op Plugins → Skills.
  2. Wielt „Vun GitHub installéieren“.
  3. Pecht d'URL vum Skill-Dossier hei drënner an a bestätegt.
    https://github.com/Agents365-ai/365-skills/tree/main/plugins/xfetch/skills/xfetch-skill
  4. Aktivéiert de Skill an all Chat, an deem Dir e benotze wëllt.
Plugins → Skills → Skill afügen → Vu GitHub-URL, pecht dann d'URL vum Dossier an a klickt op Weider.
2

An engem anere KI-Agent installéieren

All KI-Agent, deen d'Format Agent Skills liest, kann dëse Skill benotzen — kopéiert den Dossier an de Skill-Verzeechnes vun deem KI-Agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/Agents365-ai/365-skills.git /tmp/365-skills
mkdir -p .claude/skills
cp -r /tmp/365-skills/plugins/xfetch/skills/xfetch-skill .claude/skills/xfetch
Start Claude Code nom Kopéieren nei, fir datt den neie Skill erkannt gëtt.

An TypingMind benotzen

Aktivéiert Xfetch an engem Chat vun TypingMind, an de Modell iwwerhëlt de Rescht. Den Numm an d'Beschreiwung stinn am System-Prompt. Soubal eng Ufro dozou passt, luet de Modell déi komplett Instruktioune selwer — Dir musst de Skill ni manuell opruffen, an et fale keng Token un, bis en tatsächlech benotzt gëtt.

De Modell luet Xfetch automatesch, soubal eng Ufro dozou passt.

Funktionéiert mat all KI-Modell

KI-Skills si reng Markdown-Instruktiounen amplaz vun ubidderspezifeschem Code. Dofir ass Xfetch net un de Modell gebonnen, fir deen de Skill geschriwwe gouf. Installéiert en eemol an TypingMind a benotzt e mat GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder engem lokale Modell, deen Dir selwer bedreift — alles mat Ären eegenen API-Keys.

  • Gëtt nëmme gelueden, wann et néideg ass

    De System-Prompt enthält nëmmen den Numm an d'Beschreiwung. D'Instruktioune gi bei der éischter passender Ufro gelueden, soudatt en onbenotzte Skill näischt kascht.

  • De Modell am lafende Chat wiesselen

    Well de Skill aus Instruktiounen amplaz vu Code besteet, funktionéiert en och no engem Modellwiessel — den nächste Modell liest déi selwecht SKILL.md-Datei.

Skill-Instruktiounen

Dëst ass den Inhalt vu SKILL.md, deen de Modell luet. Liest e virun der Installatioun — e Skill besteet aus Instruktiounen, déi Äre Modell befollegt.

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:

  • stdout carries the data payload only (JSON by default). Redirect or pipe it — nothing else is written there.
  • stderr carries 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 carries rate_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)

  1. Confirm Python and install twikit (a virtualenv is cleanest so you don't touch system packages):

    bash
    python3 -m pip install -r scripts/requirements.txt   # installs twikit>=2.3.3
  2. Verify the CLI loads:

    bash
    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:

bash
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):

    bash
    python3 scripts/xfetch.py auth extract --browser chrome
    # supported: chrome, chromium, firefox, safari, edge, brave, arc, opera, vivaldi, librewolf

    Requires browser_cookie3 (in requirements.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.txt or JSON both work), then point the CLI at the file — it extracts auth_token + ct0 for you:

    bash
    python3 scripts/xfetch.py auth import --file ~/Downloads/x.com_cookies.txt
  • Paste cookie tokens (works for any browser): open DevTools → Application → Cookies → https://x.com, copy the auth_token and ct0 values, then:

    bash
    python3 scripts/xfetch.py auth set --auth-token <token> --ct0 <token>
  • Environment variables (good for CI / one-off, saves nothing to disk):

    bash
    XFETCH_AUTH_TOKEN=<token> XFETCH_CT0=<token> python3 scripts/xfetch.py user @handle
  • Username/password login (twikit performs a real login; may trip a captcha or 2FA — pass --totp for TOTP-based 2FA):

    bash
    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 its login is a shared, rate-limited resource: don't hammer it.

Choose the output format for the consumer

The default json is pretty-printed for a human reading one result. For anything you or a pipeline will parse, pick deliberately with --format:

FormatFlagUse when
JSON (pretty)(default)Inspecting a single object or a small result
JSONL--format jsonlLarge / multi-page results — one record per line, appendable, stream-friendly
CSV--format csvSpreadsheets or quick tabular analysis (nested fields are JSON-encoded in-cell)
SQLite--format sqlite --db out.dbBuilding a queryable dataset; rows go to a tweets/users table, a summary prints to stderr

Add --plain for compact single-line JSON. Save to a file by redirecting stdout, e.g. … --format jsonl > tweets.jsonl.

Commands

bash
# Profile (by @handle or numeric id)
python3 scripts/xfetch.py user @elonmusk

# A user's tweets (--replies for replies, --media for media-only)
python3 scripts/xfetch.py tweets @elonmusk -n 50
python3 scripts/xfetch.py tweets @elonmusk --replies --all --format jsonl > timeline.jsonl

# A user's liked tweets
python3 scripts/xfetch.py likes @handle -n 40

# Single tweet, and a tweet with its replies (thread)
python3 scripts/xfetch.py tweet https://x.com/user/status/1234567890
python3 scripts/xfetch.py thread 1234567890

# Search (--type top|latest|media)
python3 scripts/xfetch.py search "AI agents" -n 100 --type latest
python3 scripts/xfetch.py search "from:openai since:2024-01-01" --all --format csv > openai.csv

# Followers / following, paginated into a SQLite dataset
python3 scripts/xfetch.py followers @handle --all --format sqlite --db network.db
python3 scripts/xfetch.py following @handle -n 100

# Your own timelines (uses the logged-in account)
python3 scripts/xfetch.py home              # "For You"
python3 scripts/xfetch.py home --following  # chronological
python3 scripts/xfetch.py bookmarks -n 50

search supports X's advanced operators (from:, to:, since:, until:, filter:, min_faves:, etc.) — pass them inside the quoted query. For the full flag reference and the exact fields each command returns, read references/commands.md.

DMs, lists, and trends are not exposed as commands (to keep this CLI small), but twikit supports them (get_dm_history, get_list_tweets, get_trends) — add a command following the existing pattern in scripts/xfetch.py if the user needs one.

Pagination and rate limits

Listing commands (tweets, search, followers, following, likes, home, bookmarks) share these flags — single page by default, opt into more:

bash
-n 40            # results per page
--all            # every page until exhausted
--max-pages 10   # cap the pages
--cursor <c>     # start from a specific pagination cursor
--delay 1.5      # seconds between pages (default 1.0 — keep it >0 for --all)

When more pages remain — or a pull is interrupted or rate limited mid-way — the CLI prints next_cursor=<value> to stderr. Capture it and pass it back via --cursor to resume exactly where the pull stopped instead of refetching from the top.

X enforces per-account rate limits (roughly a few hundred requests per 15-minute window per endpoint) and this uses the user's real account. For bulk pulls keep a real --delay, prefer --max-pages over --all when you only need a sample, and remember aggressive scraping can get the account throttled or flagged. Route through a proxy for heavier work with --proxy http://user:pass@host:port.

When something fails

Check the exit code, then read stderr to classify:

  • exit 2 / Not authenticated → run the auth flow above.
  • exit 64 / usage error → the command line itself is wrong (unknown flag, bad value). Fix the invocation — do not re-run auth.
  • exit 3 / rate limited → stderr carries rate_limit_reset=<epoch>; wait until then, raise --delay, and resume from the next_cursor= value printed on stderr.
  • exit 1 with a GraphQL / parsing error that started suddenly for everyone → X likely changed its site. Upgrade twikit (pip install -U twikit) and retry.
  • Timeout / network errors mid-pull → resume from the next_cursor= line on stderr instead of refetching from the top.
  • Empty result → the account may be private (you only see what the logged-in account can), suspended, or the handle is wrong.

Scope and good-citizen notes

This reads public data plus whatever the logged-in account can see (its own home, bookmarks, likes). It does not post, like, follow, or modify anything — it's read-only by design. Because it uses the user's own session, the user is responsible for staying within X's Terms of Service and rate limits. Use it for legitimate purposes — research, personal archiving, monitoring accounts the user is entitled to read — not for harassment, mass surveillance, or evading a block. Session cookies live under ~/.config/xfetch/; clear them with auth clear.

Matgeliwwert Fichieren

De Modell liest dës Dateie bei Bedarf, wärend de Skill gelueden ass. Si ginn als liesbar Dateie bereetgestallt a ginn ni ausgeféiert.

Heefeg gestallte Froen

Wat mécht de KI-Skill 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.

Firwat Xfetch op TypingMind benotzen?

Well Dir en eemol installéiert a mat all Modell benotze kënnt. Xfetch besteet aus einfachem Markdown amplaz vun ubidderspezifeschem Code. Dee selwechte Skill funktionéiert also mat GPT-5, Claude, Gemini, Grok oder engem lokale Modell – an Dir kënnt de Modell matzen am Chat wiesselen, ouni datt de Skill ophält ze funktionéieren. TypingMind benotzt Är eegen API-Schlësselen, sou datt Dir d'Ubidder direkt bezuelt amplaz vun engem Abonnement pro Benotzerplaz. Är Skills a Chats bleiwen an Ärem eegene Späicher.

Wéi installéieren ech Xfetch an TypingMind?

Maacht an TypingMind Plugins → Skills → Vu GitHub installéieren op a setzt https://github.com/Agents365-ai/365-skills/tree/main/plugins/xfetch/skills/xfetch-skill an. TypingMind liest d'Datei SKILL.md, bündelt déi zougehéiereg Dateien an installéiert dat Ganzt als Skill, deen Dir pro Chat aktivéiere kënnt.

Wéi eng KI-Modeller kënnen Xfetch benotzen?

All Modell, deen Dir an TypingMind verbënnt. KI-Skills sinn einfach Markdown-Instruktiounen an net ubidderspezifesche Code. Dofir kënne GPT, Claude, Gemini, Grok a lokal Modeller dëse Skill lueden, wann eng Ufro dozou passt.

Wéi vill KI-Modeller kann ech mat Xfetch benotzen?

Esou vill Dir wëllt. Soulaang e Modell Skills ënnerstëtzt, kënnt Dir Xfetch domat benotzen – GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama a méi – alles op TypingMind mat Ären eegenen API-Schlësselen.

Ass de KI-Skill Xfetch gratis?

Jo. De Skill gëtt vum Agents365-ai ënner der Lizenz MIT op GitHub publizéiert. Dir bezuelt nëmmen Ären eegene KI-Ubidder fir d'Token, déi Dir benotzt.

Wat si KI-Skills?

E KI-Skill ass e weiderverwendbaart Pak vun Instruktiounen, dat engem KI-Modell bäibréngt, wéi en eng bestëmmt Aufgab erfëllt. E follegt dem oppenen Agent Skills-Format: eng Datei SKILL.md mat engem Numm an enger Beschreiwung, plus all Scripten, Virlagen oder Referenzdateien, déi de Modell eventuell brauch. De Modell liest d'Instruktiounen eréischt, wann Är Ufro zum Skill passt. En installéierte Skill kascht also näischt, bis e benotzt gëtt.

Wéi ënnerscheede sech KI-Skills vu Plugins oder MCP-Serveren?

E Plugin oder MCP-Server gëtt engem Modell nei Tools, déi en opruffe kann – Code, deen iergendwou leeft an e Resultat zeréckgëtt. E KI-Skill gëtt dem Modell dogéint Wëssen an eng Virgoensweis: wéi en eng Aufgab ugeet, wéi eng Schrëtt en nokënnt a wéi eng gutt Ausgab ausgesäit. Skills bestinn aus einfachem Markdown, brauche kee Server, keen API-Schlëssel a keng Lafzäitëmfeld a funktionéiere mat all Modell.

All weisen

Elo Ären eegene KI-Workspace ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇