Data & analysis

xfetch

Try it

Use xfetch CLI to fetch X/Twitter data - tweets, user profiles, search results, timelines, lists, DMs, and notifications. Use this skill whenever you need to...

What it does

xfetch is a cookie-based X/Twitter scraper CLI. It requires no API keys - just browser cookies for authentication. It's installed globally as (or can be run via / ).

The skill document

xfetch - X/Twitter CLI Data Fetcher

xfetch is a cookie-based X/Twitter scraper CLI. It requires no API keys - just browser cookies for authentication. It's installed globally as xfetch (or can be run via npx @lxgic/xfetch / bunx @lxgic/xfetch).

Prerequisites

Authentication must be set up first. Check with:

xfetch auth check

If not authenticated, extract cookies from the user's browser:

xfetch auth extract --browser chrome          # or firefox, safari, arc, brave
xfetch auth extract --browser chrome --profile "Profile 1"  # specific profile

Or set tokens directly:

xfetch auth set --auth-token  --ct0 

Command Reference

Single Tweet

Accepts a tweet URL or numeric ID:

xfetch tweet https://x.com/user/status/123456789
xfetch tweet 123456789

Also works with X Article URLs (/article/ID).

User Profile

xfetch user @handle        # by handle (@ is optional)
xfetch user 12345678       # by numeric ID

User Tweets

xfetch tweets @handle                     # latest 20 tweets
xfetch tweets @handle -n 50              # 50 per page
xfetch tweets @handle --replies           # include replies
xfetch tweets @handle --all              # all pages (paginated)
xfetch tweets @handle --max-pages 5      # limit to 5 pages

Thread / Conversation

xfetch thread     # full conversation thread
xfetch search "query"                          # top results
xfetch search "query" --type latest            # latest tweets
xfetch search "query" --type people            # user results
xfetch search "query" --type photos            # photo tweets
xfetch search "query" --type videos            # video tweets
xfetch search "from:handle since:2024-01-01"   # advanced operators
xfetch search "query" -n 100 --all             # all pages

Search types: top (default), latest, people, photos, videos.

Timelines

xfetch home                    # algorithmic home timeline
xfetch home --following        # chronological (following only)
xfetch bookmarks               # your bookmarks
xfetch likes @handle           # user's liked tweets

Followers / Following

xfetch followers @handle -n 100
xfetch following @handle -n 100

Lists

xfetch lists @handle                        # user's lists
xfetch list                 # list details
xfetch list-members         # list members
xfetch list-tweets  -n 50   # list timeline

Direct Messages

xfetch dms                                  # inbox overview
xfetch dms inbox                            # same as above
xfetch dms conversation    # messages in a conversation
xfetch dms                 # shortcut for above

Notifications

xfetch notifications                  # all notifications
xfetch mentions                       # mentions only
xfetch verified-notifications         # from verified accounts

Auth Management

xfetch auth check                             # show auth status
xfetch auth extract --browser chrome          # extract cookies
xfetch auth set --auth-token  --ct0     # set tokens manually
xfetch auth clear                             # clear saved auth
xfetch auth browsers                          # list available browsers + profiles

Query ID Management

xfetch query-ids --refresh    # fetch latest query IDs from X frontend
xfetch query-ids --list       # show cached query IDs

Pagination Options

All list-like commands (tweets, search, followers, following, likes, bookmarks, home, notifications, mentions, list-members, list-tweets, dms inbox, dms conversation) support these pagination options:

FlagDescription
-n, --count Results per page (default: 20)
--allFetch all available pages
--max-pages Maximum number of pages to fetch
--cursor Resume from a specific cursor
--resume Save/restore cursor state to a file
--delay Delay between page requests (default: 1000ms)

Output Formats

Control output with --format:

xfetch tweets @handle --format json      # pretty-printed JSON (default)
xfetch tweets @handle --format jsonl     # newline-delimited JSON (streaming)
xfetch tweets @handle --format csv       # CSV with headers
xfetch tweets @handle --format sqlite --db tweets.db   # SQLite database

Additional output flags:

  • --json — shorthand for --format json
  • --plain — disable pretty printing

Pipe to files with shell redirection:

xfetch tweets @handle -n 100 --format csv > tweets.csv
xfetch search "AI" --all --format jsonl > results.jsonl

Global Options

These can be passed to any command:

FlagDescription
--auth-token Override auth_token cookie
--ct0 Override ct0 cookie
--cookie-source Cookie source browser
--chrome-profile Chrome profile name
--proxy Proxy URL (http://user:pass@host:port)
--proxy-file File with proxy URLs for rotation
--timeout Request timeout (default: 30000)
--delay Delay between requests (default: 500)
--no-colorDisable colored output

Tips for Effective Use

  • When fetching large datasets, prefer --format jsonl for streaming output (avoids buffering entire result set in memory).
  • Use --max-pages instead of --all when you only need a sample — it's faster and avoids rate limits.
  • If a request fails with a 404 or query ID error, try xfetch query-ids --refresh to update cached query IDs — X periodically rotates these.
  • Pipe JSON output through jq for filtering: xfetch tweets @handle | jq '.[].text'
  • For SQLite output, always specify --db: xfetch tweets @handle --format sqlite --db data.db
  • Rate limits are handled internally with jitter, but high-volume scraping benefits from --delay 2000 or higher.

Related skills

Generate and edit Draw.io, Mermaid, and Excalidraw diagrams from natural language using a structured JSON spec.

by nssa.io1.0k installs47 stars

Fetch raw ad creative, app, ranking, and revenue data from AdMapix as structured JSON.

by fly0pants

Read and write Excel workbooks, worksheets, ranges, tables, and charts in OneDrive through Microsoft Graph with managed OAuth.

by byungkyu800 installs42 stars

Stores durable facts in a categorized, plain-markdown vault on disk, alongside your agent's built-in memory.

by Iván1 installs

Join a video meeting as an AI bot with voice, avatar, and screenshare across four operating modes.

by johnpatternai21 installs8 stars

More from feiskyer

Browse all skills

深度调研的多Agent编排工作流:把一个调研目标拆成可并行子目标,用 Claude Code 非交互模式(`claude -p`)运行子进程;联网与采集优先使用已安装的 skills,其次使用 MCP 工具;用脚本聚合子结果并分章精修,最终交付"成品报告文件路径 + 关键结论/建议摘要"。用于:系统性网页/资料调...

by feiskyer39 installs1 stars

Execute long-running, multi-session tasks autonomously using Claude Code headless mode or in-session hook-based loops. Supports structured task decomposition...

by feiskyer37 installs1 stars

Use when user asks to leverage codex, gpt-5, or gpt-5.1 to implement something (usually implement a plan or feature designed by Claude). Provides non-interac...

by feiskyer38 installs1 stars

Use when user asks to leverage claude or claude code to do something (e.g. implement a feature design or review codes, etc). Provides non-interactive automat...

by feiskyer35 installs1 stars

Extract subtitles/transcripts from YouTube videos. Triggers: "youtube transcript", "extract subtitles", "video captions", "视频字幕", "字幕提取", "YouTube转文字", "提取字幕".

by feiskyer34 installs2 stars

Generate or edit images using Google Gemini API via nanobanana. Triggers: "nanobanana", "generate image", "create image", "edit image", "AI drawing", "图片生成",...

by feiskyer57 installs1 stars