askill
twitter

twitterSafety 95Repository

Fetch Twitter/X likes and bookmarks. Use when asked to download liked tweets, get Twitter bookmarks, or fetch saved tweets from X.

47 stars
1.2k downloads
Updated 1/24/2026

Package Files

Loading files...
SKILL.md

Twitter/X Likes and Bookmarks

Use the twitter CLI tool to fetch your liked and bookmarked tweets using browser cookies (no API credits required).

Setup

Automated Setup (Recommended)

Use agent-browser to login and automatically extract cookies:

twitter refresh

This opens a browser window where you can log in (including 2FA). Cookies are extracted automatically after successful login.

Manual Setup

Alternatively, get cookies manually from your browser:

  1. Log into https://x.com in your browser
  2. Open Developer Tools (F12) → Application → Cookies → x.com
  3. Copy the values for ct0 and auth_token
  4. Run setup:
twitter setup

Or manually create ~/.twitter_cookies.json:

{"ct0": "your_ct0_value", "auth_token": "your_auth_token_value"}

⚠️ Security: Never save cookies inside a git repository. The default location (~/.twitter_cookies.json) is outside your repo. If you use --path, ensure the file is in .gitignore.

Usage

Fetch Likes

# Output liked tweets to stdout as JSON (requires TWITTER_USERNAME env var or --username)
twitter likes -u myusername

# Save to a file
twitter likes -u myusername -o likes.json

# Limit to most recent 50 likes
twitter likes -u myusername -n 50 -o recent-likes.json

# Verbose mode shows progress
twitter likes -u myusername -v -o all-likes.json

# Auto-refresh cookies if expired (opens browser for login)
twitter likes -u myusername --auto-refresh -o likes.json

# Raw API response (for debugging)
twitter likes -u myusername --raw -n 5

Fetch Bookmarks

# Output bookmarks to stdout as JSON
twitter bookmarks

# Save to a file
twitter bookmarks -o bookmarks.json

# Limit number of bookmarks
twitter bookmarks -n 100 -o bookmarks.json

# Auto-refresh if cookies are expired
twitter bookmarks --auto-refresh -v -o bookmarks.json

Commands

CommandDescription
twitter refreshAutomated cookie refresh via browser (recommended)
twitter setupManual interactive setup to save cookies
twitter likesFetch your liked tweets
twitter bookmarksFetch your bookmarked tweets
twitter screenshotTake a screenshot of a tweet

Options

OptionShortDescription
--output-oOutput file path (default: stdout)
--limit-nMaximum number of tweets to fetch
--verbose-vShow progress information
--auto-refresh-aAuto-refresh cookies via browser if expired
--username-uTwitter username (likes command only, or set TWITTER_USERNAME)
--rawOutput raw API response
--full-page-fCapture full page (screenshot only)
--wait-wSeconds to wait for page load (screenshot only)

Output Format

Returns JSON array of tweet objects:

[
  {
    "id": "1234567890",
    "text": "Tweet content here...",
    "created_at": "Fri Jan 23 20:01:07 +0000 2026",
    "author": {
      "id": "987654321",
      "username": "example_user",
      "name": "Example User"
    },
    "metrics": {
      "like_count": 100,
      "retweet_count": 10,
      "reply_count": 5,
      "quote_count": 2
    },
    "url": "https://x.com/example_user/status/1234567890"
  }
]

Environment Variables

  • TWITTER_USERNAME - Your Twitter username for likes lookup (required for likes command unless using --username)
  • TWITTER_COOKIES_FILE - Path to cookies file (default: ~/.twitter_cookies.json)

Requirements

The hamel package must be installed: pip install hamel

Optional Dependencies

For twitter refresh (automated cookie extraction):

npm install -g agent-browser
# Or use via npx (no install needed): npx agent-browser

See the agent-browser skill for more details.

For twitter screenshot:

pip install playwright && playwright install chromium

Examples

Download all likes and analyze with AI:

twitter likes -u myusername -o /tmp/likes.json
ai-gem "What topics am I most interested in based on my likes?" /tmp/likes.json

Get recent bookmarks for reference:

twitter bookmarks -n 20 -v

Export all bookmarks:

twitter bookmarks -o ~/bookmarks-backup.json -v

Screenshot a Tweet

# Screenshot a tweet (saves to tweet_<id>.png)
twitter screenshot https://x.com/user/status/1234567890

# Save to specific file
twitter screenshot https://x.com/user/status/1234567890 -o my_tweet.png

# Full page screenshot
twitter screenshot https://x.com/user/status/1234567890 --full-page

# Wait longer for slow loading tweets
twitter screenshot https://x.com/user/status/1234567890 --wait 5 -v

Troubleshooting

"Cookies file not found": Run twitter refresh (automated) or twitter setup (manual) to configure authentication.

Empty results or auth errors: Your cookies may have expired. Use --auto-refresh flag to automatically refresh, or run twitter refresh manually.

Rate limiting: The tool uses Twitter's internal API. If you hit rate limits, wait a few minutes before retrying.

agent-browser not found: Install with npm install -g agent-browser or use via npx agent-browser for automated cookie refresh.

playwright not installed: For screenshots, install with pip install playwright && playwright install chromium.

Install

Download ZIP
Requires askill CLI v1.0+

AI Quality Score

95/100Analyzed 2/12/2026

An exceptionally well-documented skill for a Twitter CLI tool, featuring comprehensive setup guides, clear command references, and proactive security warnings.

95
100
90
100
100

Metadata

Licenseunknown
Version-
Updated1/24/2026
Publisherhamelsmu

Tags

apiobservabilitysecurity