Skip to content

Latest commit

 

History

126 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

X (Twitter) Scraper CLI by Xquik

Framer builds a tweet ticker with Xquik
Watch Framer build a tweet ticker with Xquik, from 6:07. This CLI calls the Xquik API.

Use this Twitter CLI by Xquik to search tweets & export followers as JSON. It runs in a terminal or a script. Public reads need no X (Twitter) developer account.

Xquik is the world's fastest and cheapest X (Twitter) scraper service with the most complete X (Twitter) data. Most other Apify Actors charge before filtering or deduplication. Xquik charges only for delivered, unique, filter-matching results and never pads rows. Xquik is independent and not affiliated with X Corp.

The Xquik REST API read 45 tweets per second on 2026-10-15. That cost $0.15 per 1,000. The fastest of 4 rival Actors read 12.5 per second. The cheapest cost $0.173 per 1,000. Compare each run. Most rival Actors charge before they filter or dedup. Xquik charges only for delivered, unique, filter-matching results.

Install the Twitter CLI

Install Node.js 18 or later, then install the npm package.

npm install --global x-twitter-scraper-cli

Or run the CLI once without installing it.

npx x-twitter-scraper-cli --help

npm installs only the build for your platform. Nothing downloads when the CLI runs.

Scrape tweets from the X CLI

Create an API key in the Xquik dashboard and export it.

export X_TWITTER_SCRAPER_API_KEY="your-api-key"

This command returns 10 recent X (Twitter) posts from 1 account.

x-twitter-scraper x:tweets search \
  --q from:elonmusk \
  --limit 10

Next, read the CLI guide, REST API reference or search operators.

Benchmarks & usage

X (Twitter) API package downloads X (Twitter) API p99 server read time OpenSSF Best Practices

  • 74,000+ downloads of Xquik's X (Twitter) API packages across 6 registries (source)
  • 35.8 s p99 REST server read time over 7 days, failures included (source)
  • This repo meets the OpenSSF Best Practices passing criteria (source)

Checked on 2026-11-30. See each number with its date & source on xquik.com/benchmarks or as JSON.

More ways to install

Install with Go

Install Go 1.21 or later. Go downloads the toolchain this CLI needs.

go install 'github.com/Xquik-dev/x-twitter-scraper-cli/cmd/x-twitter-scraper@latest'

Go writes the binary to $GOBIN or $(go env GOPATH)/bin. If the command is unavailable, add that directory to PATH.

export PATH="$PATH:$(go env GOPATH)/bin"

Download a release

Each GitHub release has archives for macOS, Linux & Windows. Linux users can also pick a .deb, .rpm, .apk or Arch Linux package. Compare each download with the release's checksums file.

From a cloned repository, run ./scripts/run args... instead.

Twitter scraper commands

Each command follows the same shape.

x-twitter-scraper [resource] <command> [flags...]

Run a command with --help before you add flags.

Task Start command
Search tweets x-twitter-scraper x:tweets search --help
Get a user's posts x-twitter-scraper x:users retrieve-tweets --help
Scrape Twitter followers x-twitter-scraper x:users retrieve-followers --help
Scrape following accounts x-twitter-scraper x:users retrieve-following --help
Read a home timeline x-twitter-scraper x get-home-timeline --help
Export a large dataset x-twitter-scraper extractions estimate-cost --help
Monitor an account x-twitter-scraper monitors create --help
Post a tweet or reply x-twitter-scraper x:tweets create --help

Environment variables

Environment variable Description Required Default value
X_TWITTER_SCRAPER_API_KEY Xquik API key no null
X_TWITTER_SCRAPER_BEARER_TOKEN OAuth 2.1 access token no null

Global flags

  • --api-key sets the Xquik API key.
  • --bearer-token sets an OAuth 2.1 access token.
  • --help shows command-line usage.
  • --debug adds HTTP request & response details to logs.
  • --version or -v shows the CLI version.
  • --base-url sends requests to another API base URL.
  • --format sets the output format.
  • --format-error sets the error format.
  • --transform filters output with GJSON syntax.
  • --transform-error filters errors with GJSON syntax.
  • --raw-output or -r prints a string result without JSON quotes.

Credential flags also read their matching environment variables. Debug logs may contain private response data. Do not share them.

Passing files as arguments

Prefix a path with @ to send its contents.

x-twitter-scraper <command> --arg @abe.jpg

Use file references inside JSON or YAML.

x-twitter-scraper <command> --arg '{image: "@abe.jpg"}'
# The same input as YAML.
x-twitter-scraper <command> <<YAML
arg:
  image: "@abe.jpg"
YAML

Escape a leading @ when sending a literal value.

x-twitter-scraper <command> --username '\@abe'

JSON endpoints detect text and binary files. Use @file:// for text, @data:// for base64, and 3 slashes for absolute paths.

x-twitter-scraper <command> --arg @data://file.txt

Checks & releases

Run bin/check-local before you open a pull request. It posts the result as the xquik-local-checks commit status. Maintainers publish releases from main with bin/release-local. bin/release-local --dry-run builds every release asset and publishes nothing.

Questions

Do I need an X (Twitter) developer account?

No. Public reads need only an Xquik API key. Private reads & account actions need a connected X (Twitter) account.

Is this the official X API?

No. Xquik runs its own REST API. This CLI calls that API, not the official X API.

More Xquik tools

Support & policies

Xquik is an independent third-party service. Not affiliated with X Corp. "Twitter" and "X" are trademarks of X Corp.

Releases

Packages

Contributors

Languages