npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

x-reader

v0.1.0

Published

Read-only Twitter/X CLI. Search tweets, read timelines, bookmarks, and replies from the terminal.

Readme

x-reader

npm version License: MIT Node.js TypeScript

Read-only Twitter/X CLI for searching tweets, reading timelines, bookmarks, and replies from the terminal. Inspired by Bird CLI.

Uses your own X/Twitter cookies. One user, one account. No API keys required.

Features

  • Search tweets by keyword or advanced query (from:, to:, filter:, etc.)
  • Read a user's timeline
  • Read a single tweet by ID or URL
  • Read replies to any tweet
  • Read your bookmarks (with --all for full export)
  • Look up user profiles by handle
  • JSON output for piping into other tools (jq, scripts, etc.)
  • Auto-discovers X's rotating GraphQL query IDs (no manual updates needed)
  • Zero config beyond two browser cookies

Why x-reader?

  • No Twitter API keys or developer account needed
  • Read-only by design (no accidental tweets, likes, or follows)
  • Works with X's current GraphQL endpoints
  • Lightweight: single dependency (Commander)
  • Scriptable: JSON output for automation and data pipelines

Install

From npm (recommended)

npm install -g x-reader

From source

git clone https://github.com/DjinnFoundry/x-reader.git
cd x-reader
npm install
npm run build
npm link

Quick start

# 1. Set up authentication (interactive)
x-reader setup

# 2. Search tweets
x-reader search "machine learning"

# 3. Read a user's timeline
x-reader user-tweets @naval -n 10

# 4. Export your bookmarks as JSON
x-reader bookmarks --all --format json > bookmarks.json

Authentication

You need two cookies from x.com: auth_token and ct0.

Option 1: Interactive setup

x-reader setup

Option 2: Environment variables

export AUTH_TOKEN="your_auth_token"
export CT0="your_ct0"

Option 3: CLI flags

x-reader search "query" --auth-token xxx --ct0 yyy

Where to find your cookies

  1. Go to x.com and log in
  2. Open DevTools (F12) -> Application -> Cookies -> x.com
  3. Copy auth_token and ct0 values

Config is saved to ~/.config/x-reader/config.json.

Usage

Search tweets

x-reader search "machine learning"
x-reader search "from:elonmusk" -n 5
x-reader search "AI safety" --format json

Read a user's timeline

x-reader user-tweets @steipete
x-reader user-tweets elonmusk -n 10
x-reader user-tweets @naval --format json

Read a single tweet

x-reader read 1234567890
x-reader read https://x.com/user/status/1234567890
x-reader read https://x.com/user/status/1234567890 --format json

Read replies

x-reader replies 1234567890
x-reader replies https://x.com/user/status/1234567890 --format json

Export bookmarks

x-reader bookmarks
x-reader bookmarks -n 50
x-reader bookmarks --all --format json

User lookup

x-reader user-lookup @steipete
x-reader user-lookup naval --format json

Query ID management

# Show cached query IDs
x-reader query-ids

# Force refresh from x.com (when IDs rotate)
x-reader query-ids --refresh

Output formats

  • text (default) - human-readable
  • json - machine-readable, pipe to jq or save to file
# Pipe to jq
x-reader search "typescript" --format json | jq '.tweets[].text'

# Save to file
x-reader bookmarks --all --format json > my-bookmarks.json

Programmatic use

import { XReaderClient } from 'x-reader';

const client = new XReaderClient({
  cookies: { authToken: '...', ct0: '...' },
});

const result = await client.search('hello world', 10);
console.log(result.tweets);

How it works

X uses GraphQL endpoints with rotating query IDs embedded in their client-side JavaScript bundles. x-reader auto-discovers these IDs by scraping the JS bundles, caching them locally with a 24-hour TTL. No manual ID updates needed.

If you get 404 errors, force a refresh:

x-reader query-ids --refresh

Architecture

src/
├── api/
│   ├── client.ts      # Main API client (read-only operations)
│   ├── constants.ts   # Bearer token, URLs, default query IDs
│   ├── features.ts    # GraphQL feature flags per operation
│   ├── parser.ts      # Response parsing (raw JSON -> Tweet/User)
│   ├── query-ids.ts   # Auto-discovery of query IDs from x.com JS
│   └── types.ts       # TypeScript interfaces
├── cli/
│   └── index.ts       # CLI entry point (commander)
├── utils/
│   ├── auth.ts        # Cookie resolution (env, config, bird compat)
│   └── format.ts      # Output formatting
└── index.ts           # Library exports

Credits

  • Inspired by Bird CLI by @steipete
  • Uses the same public bearer token as the X web client
  • Query ID discovery mechanism reverse-engineered from Bird v0.8.0

License

MIT