A CLI tool for extracting follower and following counts for X (Twitter) accounts via direct HTTP requests — no browser required.
GitHub: github.com/daviddanielng/xcount
Note: Release is no longer up to date, you must run it with
cargo run
- Linux: pre-compiled binary available
- Windows / macOS: must build from source (see Building from Source)
Note: Release is no longer up to date, you must run it with
cargo run
Download the latest binary from the Releases tab on GitHub, then make it executable:
chmod +x xcount
./xcount --helpOptionally move it onto your $PATH:
mv xcount ~/.local/bin/xcountRequires Rust (stable toolchain).
git clone https://github.com/daviddanielng/xcount.git
cd xcount
cargo build --releaseThe compiled binary will be at target/release/xcount. You can move it anywhere on your $PATH:
cp target/release/xcount ~/.local/bin/xcount # Linux / macOSxcount [OPTIONS] --username <USERNAMES> | --input <FILE>
| Flag | Short | Default | Description |
|---|---|---|---|
--username <USERNAMES> |
-u |
— | Comma-separated list of usernames (mutually exclusive with -i) |
--input <FILE> |
-i |
— | Path to a file with one username per line (mutually exclusive with -u) |
--format <FORMAT> |
-f |
json |
Output format: json, csv, or excel |
--output <DIR> |
-o |
. |
Directory to write the output file into |
--delay <SECONDS> |
-d |
1 |
Seconds to wait between each request |
--verbose |
-v |
false |
Print progress and log info to stderr |
xcount -u daviddanielng
xcount -u daviddanielng,elonmusk,githubResults are always saved to a file — never printed. The file is named output-{timestamp}.{ext} and
written to the current directory by default.
output-{yyyy-mm-dd-hh::mm}.json
The file must have one username per line.
xcount -i ./users.txt
xcount -i /home/daniel/usernames.txtusers.txt example:
daviddanielng
elonmusk
github
Use -f to set the format. Accepted values are json, csv, and excel. Defaults to json.
xcount -u daviddanielng,elonmusk -f csv
xcount -u daviddanielng,elonmusk -f excel
xcount -i ./users.txt -f jsonOutput filenames follow the pattern output-{timestamp}.{ext}:
output-{yyyy-mm-dd-hh::mm}.json
output-{yyyy-mm-dd-hh::mm}.csv
output-{yyyy-mm-dd-hh::mm}.xlsx
Use -o to set the directory the output file is written to. Defaults to the current directory.
xcount -u daviddanielng,elonmusk -o ./results
xcount -i ./users.txt -f excel -o /tmpUse -d to add a pause (in seconds) between each username fetch. Defaults to 1. Increase this to
reduce the chance of getting IP-banned when processing large lists.
xcount -u daviddanielng,elonmusk,github -d 3
xcount -i ./users.txt -f csv -d 5Add -v to print progress logs during the run. Useful for monitoring or debugging.
xcount -u daviddanielng,elonmusk -v[INFO] Fetching profile: daviddanielng
[INFO] Fetching profile: elonmusk
[INFO] Done. Output saved to output-{yyyy-mm-dd-hh::mm}.json
If a username cannot be fetched (not found, private, rate-limited, etc.) you will see something like this in the output:
error: is true
[
{
"username": "daviddanielng",
"followers": 0,
"following": 0,
"tweets": 0,
"error": true
}
]Each record in the output contains the username, follower count, following count, tweet count and error status.
JSON example:
[
{
"username": "daviddanielng",
"followers": 166,
"following": 418,
"tweets": 6076,
"error": false
}
]Note: It is the same in both CSV and Excel formats.
Note on accuracy: Counts are read directly from the page's
application/ld+jsonstructured data, not parsed from the shortened display text (e.g.1.2M,418K) shown in the UI. This means counts are exact, even for accounts with very large follower numbers.
-uand-iare mutually exclusive — exactly one must be provided.- Output is always written to a file — results are never printed to the terminal.
- The output file is named
output-{timestamp}.{ext}and written to the directory set by-o( defaults to the current directory). - The delay set with
-dapplies between usernames, not before the first one. - The pre-compiled binary targets Linux x64 only. All other platforms require building from
source with
cargo.
Issues and pull requests are welcome. If you run into a bug or want to suggest a feature, open an issue on the GitHub repository.
When submitting a PR:
- Run
cargo fmtandcargo clippybefore committing - Keep changes focused — one fix or feature per PR
- If you're adding behaviour, update this README to reflect it
MIT © Daniel Enubiaka