Fast CLI for Threads — read posts, browse profiles, search users from the terminal
npm install yarn-threads-cliA fast, lightweight CLI for Threads — read posts, browse profiles, search users, and more from your terminal.
``bash
yarn-threads whoamiJeizzon Mendes @jeizzon.mp4
✅ Authenticated successfully
yarn-threads about zuck
yarn-threads user-posts zuck
Features
- Post, reply, quote — Create posts, reply to threads, quote existing posts
- Read posts — Fetch any thread by URL or shortcode
- Browse profiles — View user info, posts, followers, following
- Search users — Find accounts by name or handle
- View likes — See your liked posts
- Replies — Get reply threads for any post
- Cookie-based auth — Uses your existing browser session (no OAuth needed)
- Multiple output formats — Human-friendly, plain text, or JSON
Installation
`bash
npm install -g yarn-threads-cli
`$3
`bash
git clone https://github.com/jeizzon/yarn-threads-cli.git
cd yarn-threads-cli
npm install
npm run build
npm link
`Authentication
yarn-threads-cli uses cookies from your browser to authenticate with Threads. You must be logged into Threads in your browser.
$3
`bash
Use default Chrome profile
yarn-threads whoamiUse a specific Chrome profile directory
yarn-threads --chrome-profile-dir "/path/to/chrome/profile/Default" whoamiUse Chrome profile by name
yarn-threads --chrome-profile "Profile 1" whoami
`$3
`bash
yarn-threads --firefox-profile "default-release" whoami
`$3
`bash
yarn-threads --session-id "YOUR_SESSION_ID" --csrf-token "YOUR_CSRF_TOKEN" whoami
`Or via environment variables:
`bash
export THREADS_SESSION_ID="..."
export THREADS_CSRF_TOKEN="..."
yarn-threads whoami
`$3
The CLI automatically extracts cookies from Safari, Chrome, and Firefox. On macOS, it uses the system keychain to decrypt Chrome cookies.
Commands
$3
`bash
yarn-threads whoami
yarn-threads whoami --json
`$3
`bash
yarn-threads about zuck
yarn-threads about @mosseri
yarn-threads about 314216 --json # by user ID
`$3
`bash
yarn-threads user-posts zuck
yarn-threads user-posts mosseri --limit 5
`$3
`bash
yarn-threads read https://www.threads.net/@zuck/post/DTa3-B1EbTp
yarn-threads read DTa3-B1EbTp # shortcode only
yarn-threads read 3812345678901234567 # post ID
`$3
`bash
yarn-threads replies https://www.threads.net/@zuck/post/DTa3-B1EbTp
yarn-threads replies DTa3-B1EbTp --limit 10
`$3
`bash
yarn-threads thread https://www.threads.net/@zuck/post/DTa3-B1EbTp
`$3
`bash
yarn-threads search "design"
yarn-threads search "AI" --limit 20
`> Note: Search returns users, not posts (Instagram API limitation).
$3
`bash
yarn-threads likes
yarn-threads likes --limit 50
`$3
`bash
yarn-threads followers zuck
yarn-threads followers zuck --limit 100
`$3
`bash
yarn-threads following zuck
yarn-threads following jeizzon.mp4 --limit 50
`$3
`bash
yarn-threads post "Hello from the terminal!"
yarn-threads post "Only friends can reply" --reply-control accounts_you_follow
yarn-threads post "Mentioned only" --reply-control mentioned_only
`Reply control options:
-
everyone (default) — Anyone can reply
- accounts_you_follow — Only accounts you follow can reply
- mentioned_only — Only mentioned accounts can reply$3
`bash
yarn-threads reply https://www.threads.net/@zuck/post/DTa3-B1EbTp "Great post!"
yarn-threads reply DTa3-B1EbTp "Nice one" # shortcode
`$3
`bash
yarn-threads quote https://www.threads.net/@zuck/post/DTa3-B1EbTp "This is important"
yarn-threads quote DTa3-B1EbTp "Thoughts on this:"
`Output Formats
$3
`bash
yarn-threads about zuck
`$3
`bash
yarn-threads about zuck --plain
`$3
`bash
yarn-threads about zuck --json
`Configuration
Create
~/.config/yarn/config.json5:`json5
{
// Chrome profile directory (full path)
chromeProfileDir: "/Users/you/.clawdbot/browser/clawd/user-data/Default",
// Or Chrome profile name
chromeProfile: "Default",
// Firefox profile name
firefoxProfile: "default-release",
// Request timeout (ms)
timeoutMs: 30000,
// Cookie extraction timeout (ms)
cookieTimeoutMs: 5000,
}
`Environment Variables
| Variable | Description |
|----------|-------------|
|
THREADS_SESSION_ID | Session cookie value |
| THREADS_CSRF_TOKEN | CSRF token cookie value |
| THREADS_USER_ID | User ID cookie value |
| NO_COLOR | Disable colored output |Current Limitations
$3
| Command | Status | Reason |
|---------|--------|--------|
|
home | ❌ | Home timeline requires app-level authentication |
| saved | ❌ | Saved posts endpoint not publicly accessible |$3
- Search returns users only — The Instagram mobile API doesn't expose post search. Use the Threads web app for searching posts.
$3
- The Instagram API may rate-limit requests if you make too many in a short period.
- If you encounter errors, wait a few minutes before retrying.
$3
- Session cookies expire periodically. If authentication fails, log into Threads in your browser again.
How It Works
yarn-threads-cli uses the Instagram mobile API (
i.instagram.com) with your browser session cookies. This is the same API that the Threads mobile app uses.Why not the official Threads API?
The official Threads API requires:
- Meta developer app registration
- OAuth flow for authentication
- Access token management
The cookie-based approach works with your existing browser session — no app registration needed.
Development
`bash
Install dependencies
npm installBuild
npm run buildRun tests
npm testWatch mode
npm run dev
``Inspired by bird (Twitter/X CLI) and threads-api.
MIT