A fast, native Linux Twitter/X CLI client written in Go. Bird-Go bypasses Twitter's restrictive API by using your browser's session cookies to interact with Twitter's internal GraphQL endpoints.
- 🚀 Native Go Binary - Single executable, no runtime dependencies
- 🔐 Cookie-Based Auth - Automatically extracts session from Chrome/Firefox
- 🐧 Linux Optimized - Built specifically for Linux (amd64/arm64)
- ⚡ Fast & Lightweight - Minimal overhead, instant startup
- 🔒 No API Keys Required - Uses your existing browser session
git clone https://github.com/dazeb/bird-go.git
cd bird-go
go build -ldflags="-s -w" -o bin/bird ./cmd/bird
sudo mv bin/bird /usr/local/bin/- Go 1.24 or later
- Chrome, Chromium, or Firefox installed natively (not Snap/Flatpak)
- Active Twitter/X session in your browser
Bird-Go provides several commands to interact with Twitter/X from the command line. All commands support the global --debug flag for verbose output.
# Post a tweet (default command)
bird "Hello from Bird-Go!"For AI agents: Below is a structured reference of all available commands in machine-readable format.
# BIRD-GO CLI COMMANDS
## PROJECT INFO
- Binary: bird
- Language: Go
- Purpose: Twitter/X CLI client using browser cookies
- Auth: Automatic cookie extraction from Chrome/Firefox or env vars
## GLOBAL FLAGS
--debug, -d Enable debug mode with verbose output
--help, -h Show help information
## AVAILABLE COMMANDS
### DEFAULT COMMAND
Command: bird [text]
Description: Post a tweet (default action)
Args:
- text (required): Tweet content as string
Exit Code: 0 on success, 1 on error
Output: Tweet ID and URL on success
Example: bird "Hello World"
### POST
Command: bird post [text]
Description: Post a tweet to Twitter/X
Args:
- text (required): Tweet content as string
Exit Code: 0 on success, 1 on error
Output: Tweet ID and URL on success
Example: bird post "Hello World"
### LOGIN
Command: bird login
Description: Verify cookie extraction and authentication
Args: None
Exit Code: 0 on success, 1 on error
Output: Cookie source and masked tokens
Example: bird login
### TIMELINE
Command: bird timeline
Description: View home timeline (NOT YET IMPLEMENTED)
Args: None
Status: Not implemented
Exit Code: 1 (not implemented)
Output: Error message
Example: bird timeline
## ENVIRONMENT VARIABLES
BIRD_AUTH_TOKEN Twitter auth_token cookie value
BIRD_CT0 Twitter ct0 CSRF token value
## AUTHENTICATION PRIORITY
1. Environment variables (BIRD_AUTH_TOKEN, BIRD_CT0)
2. Browser cookies (Chrome → Chromium → Firefox)
## BUILD COMMANDS
go build -ldflags="-s -w" -o bin/bird ./cmd/bird Build optimized binary
go build -o bird ./cmd/bird Build standard binary
make build Build using Makefile (if exists)
## TESTING COMMANDS
go test ./... Run all tests
go test -v ./... Run tests with verbose output
## DEPENDENCY MANAGEMENT
go mod tidy Clean up dependencies
go mod download Download dependencies
go get -u <package> Update specific package
## COMMON USAGE PATTERNS
bird "$(cat file.txt)" Post from file
echo "text" | xargs bird Post from pipe
bird --debug login Debug authentication
export BIRD_AUTH_TOKEN="..." && bird Use env vars
## ERROR HANDLING
- HTTP 403: Cookies expired, refresh browser session
- HTTP 404: Query IDs rotated, update internal/client/constants.go
- Cookie not found: Browser not native install or not logged into x.com
- Auth failed: Verify browser session at x.com
## PROJECT STRUCTURE
cmd/bird/ CLI entry point and command definitions
internal/auth/ Cookie extraction logic
internal/client/ Twitter GraphQL client
internal/models/ Data structures and GraphQL types
go.mod Go module dependenciesAll commands support the following flags:
-d, --debug Enable debug mode (shows detailed credential info)
-h, --help Show help informationPost a tweet directly without using the post subcommand.
Syntax:
bird [text]Examples:
# Post a simple tweet
bird "Hello from Bird-Go!"
# Post a multi-line tweet
bird "Line 1
Line 2
Line 3"
# Post with debug mode
bird --debug "Testing debug output"Output:
Posting tweet: Hello from Bird-Go!
✓ Tweet posted successfully!
Tweet ID: 1234567890123456789
URL: https://x.com/i/status/1234567890123456789
Post a new tweet to your Twitter/X account.
Syntax:
bird post [text]Examples:
# Post a tweet
bird post "Hello from Bird-Go!"
# Post with emoji
bird post "🚀 Launching Bird-Go!"
# Post with hashtags
bird post "Testing #BirdGo #TwitterCLI"
# Post with debug mode
bird post --debug "Debug tweet"Output:
Posting tweet: Hello from Bird-Go!
✓ Tweet posted successfully!
Tweet ID: 1234567890123456789
URL: https://x.com/i/status/1234567890123456789
Verify that Bird-Go can extract Twitter session cookies from your browser.
Syntax:
bird loginExamples:
# Check authentication
bird login
# Check authentication with full token display
bird login --debugOutput (Normal):
✓ Successfully found Twitter cookies!
Source: Chrome
auth_token: ****abc123
ct0: ****xyz789
Output (Debug Mode):
✓ Successfully found Twitter cookies!
Source: Chrome
auth_token: 1a2b3c4d5e...890xyz123abc
ct0: abcdef1234...567890zyxw
Fetch and display your Twitter/X home timeline.
Syntax:
bird timelineStatus: 🚧 Not yet implemented
Examples:
# View your timeline (coming soon)
bird timelineOverride automatic cookie detection with manual credentials:
# Set credentials
export BIRD_AUTH_TOKEN="your_auth_token_here"
export BIRD_CT0="your_ct0_token_here"
# Post a tweet
bird "Testing with env vars"Debug mode reveals detailed information about credential sources and tokens:
# Check where credentials are coming from
bird --debug login
# Debug a tweet post
bird --debug post "Test tweet"# Read from file
bird "$(cat message.txt)"
# Pipe from another command
echo "Automated tweet" | xargs bird
# Schedule tweets with cron
echo "0 9 * * * bird 'Good morning!'" | crontab -# Quotes within tweets
bird 'He said "Hello World"'
# Newlines
bird $'First line\nSecond line\nThird line'
# Variables
MESSAGE="Hello from shell"
bird "$MESSAGE"Bird-Go uses the kooky library to extract Twitter session cookies (auth_token and ct0) from your browser's cookie database. It then uses these cookies to authenticate requests to Twitter's internal GraphQL API, the same API used by the official web client.
- Command-line arguments (if implemented)
- Environment variables (
BIRD_AUTH_TOKEN,BIRD_CT0) - Browser cookies (Chrome → Chromium → Firefox)
If automatic cookie extraction fails, you can manually provide credentials:
export BIRD_AUTH_TOKEN="your_auth_token_here"
export BIRD_CT0="your_ct0_token_here"
bird "Test tweet"Recommended: Install Chrome/Firefox using your distribution's native package manager:
# Debian/Ubuntu
sudo apt install firefox chromium-browser
# Fedora
sudo dnf install firefox chromium
# Arch
sudo pacman -S firefox chromiumTwitter occasionally rotates GraphQL Query IDs. If you encounter errors, the Query IDs in internal/client/constants.go may need updating. Check the original Bird repository for the latest values.
- Ensure you're logged into x.com in Chrome or Firefox
- Check that your browser is installed natively (not Snap/Flatpak)
- Try running with debug mode:
bird --debug login - Manually set environment variables as a fallback
Your cookies may have expired. Open x.com in your browser to refresh your session, then try again.
Twitter may have rotated the GraphQL Query IDs. Check for updates or manually update the Query IDs in internal/client/constants.go.
bird-go/
├── cmd/bird/ # CLI entry point
├── internal/
│ ├── auth/ # Cookie extraction
│ ├── client/ # Twitter API client
│ └── models/ # Data structures
└── go.mod
# Standard build
go build -o bird ./cmd/bird
# Optimized build (smaller binary)
go build -ldflags="-s -w" -o bird ./cmd/bird
# Cross-compile for ARM64
GOARCH=arm64 go build -ldflags="-s -w" -o bird-arm64 ./cmd/bird- Never commit your
auth_tokenorct0values - Bird-Go does not log credentials unless debug mode is enabled
- Cookies are read directly from browser databases and never stored
MIT License - See LICENSE file for details
This tool is for educational purposes. Use responsibly and in accordance with Twitter's Terms of Service. The author is not responsible for any misuse or violations.