X Twitter
X (Twitter) API client for searching tweets, retrieving article content, and fetching trending topics. Supports both Bearer Token (app-only) and OAuth 2.0 authentication.
MIT-0 · Free to use, modify, and redistribute. No attribution required.
⭐ 2 · 916 · 3 current installs · 5 all-time installs
MIT-0
Security Scan
OpenClaw
Benign
high confidencePurpose & Capability
Name/description match the code: scripts perform tweet search, article/tweet retrieval, and trends using X API v2. Minor inconsistency: SKILL.md / description say the skill “supports both Bearer Token (app-only) and OAuth 2.0”, but the included scripts only use a bearer token (X_BEARER_TOKEN) and do not implement an OAuth flow. Also the registry summary above listed “Required env vars: none” while the package declares a primary credential X_BEARER_TOKEN and SKILL.md instructs users to set it.
Instruction Scope
SKILL.md and the scripts only direct the agent/user to run the included Python scripts, set X_BEARER_TOKEN, call https://api.x.com/2 endpoints, and optionally save outputs to files. The instructions do not ask the agent to read arbitrary host files, other credentials, or exfiltrate data to unexpected endpoints.
Install Mechanism
No install spec; the skill is instruction-first and bundles small Python scripts. There are no remote downloads, installers, or extracted archives. Required runtime is just python3 and the requests library (imported in scripts), which is expected for these scripts.
Credentials
Only a single credential (X_BEARER_TOKEN) is used as the primary credential. That is proportionate to a client that makes authenticated calls to the X API. No unrelated secrets or config paths are requested.
Persistence & Privilege
always: false and disable-model-invocation: false (standard). The skill does not request permanent system-wide changes, nor does it modify other skills' configs. It only reads X_BEARER_TOKEN and writes user-specified output files.
Assessment
This skill appears to do what it says: three Python scripts that call X's API using a bearer token. Before installing or running: 1) Confirm you are comfortable storing X_BEARER_TOKEN in your environment (anyone with the token can access your app-level API). 2) Note the SKILL.md claim about OAuth 2.0 is not implemented in the scripts — if you need user-auth flows, this package doesn't provide them. 3) Review the scripts (they are short) before running and consider running them in an isolated environment; they only connect to https://api.x.com/2 and optionally write results to files you specify. 4) Be aware some endpoints (trends) may require a paid tier; check your token permissions and rate limits. If you need the skill to support OAuth flows or to avoid storing long-lived tokens in env vars, ask the author for clarification or an updated release.Like a lobster shell, security has layers — review code before you run it.
Current versionv1.0.1
Download ziplatest
License
MIT-0
Free to use, modify, and redistribute. No attribution required.
Runtime requirements
𝕏 Clawdis
Binspython3
Primary envX_BEARER_TOKEN
SKILL.md
X (Twitter) API
Search tweets, retrieve article content, and fetch trending topics from X (Twitter).
Features
- Search Tweets: Search recent tweets (last 7 days) with advanced query operators
- Get Article Content: Retrieve tweet and article details by URL or ID
- Trending Topics: Fetch trending topics (requires Basic tier or higher)
- User Info: Get user profile and tweet history
Setup
# Set environment variable
export X_BEARER_TOKEN="your_bearer_token_here"
# Or temporarily for this session
X_BEARER_TOKEN="your_token" python3 scripts/search_tweets.py
Get API Token:
- Visit https://developer.x.com
- Create a project and app
- Generate Bearer Token in "Keys and Tokens" tab
- Set the environment variable
Usage
Search Tweets
# Basic search
python3 scripts/search_tweets.py --query "AI OR 人工智能"
# Advanced search (Chinese original tweets only)
python3 scripts/search_tweets.py --query "AI -is:retweet lang:zh" --count 10
# Search by user
python3 scripts/search_tweets.py --query "from:elonmusk" --count 5
# Search hashtags
python3 scripts/search_tweets.py --query "#Crypto OR #Blockchain"
Query Operators:
-is:retweet- Original tweets onlylang:zh- Chinese languagefrom:username- Tweets from specific userhas:links- Tweets with linksis:verified- Verified users only
Get Article/Tweet Content
# By URL (article or tweet)
python3 scripts/get_article.py --url "https://x.com/username/article/123456789"
# By Tweet ID
python3 scripts/get_article.py --id "123456789"
Get Trending Topics
# Global trends
python3 scripts/get_trends.py
# Trends by WOEID (Yahoo Where On Earth ID)
python3 scripts/get_trends.py --woeid 1 # Global
python3 scripts/get_trends.py --woeid 23424977 # USA
API Limits
| Tier | Cost | Tweets/Month | Notes |
|---|---|---|---|
| Free | $0 | 500 | 1 request/day, testing only |
| Basic | $200 | 500,000 | Minimum production tier |
| Pro | $5,000 | 2,000,000+ | Real-time streaming |
Free tier restrictions:
- 500 tweets/month (~16-17/day)
- 1 request/day per endpoint
- No publishing/liking
- Suitable for development testing only
Output Formats
- JSON: Structured data with all fields
- Pretty: Human-readable formatted text
- Save: Optional file export (JSON/Markdown)
Error Handling
The scripts automatically handle:
- Rate limiting (429 errors)
- Invalid tokens (401 errors)
- Network errors with retry logic
- Missing required parameters
Examples
Example 1: Search AI tweets
python3 scripts/search_tweets.py --query "AI OR 人工智能 -is:retweet" --count 5 --output pretty
Example 2: Monitor specific user
python3 scripts/search_tweets.py --query "from:username" --count 10 --save output.json
Example 3: Get article and analyze
python3 scripts/get_article.py --url "https://x.com/user/article/id" --output markdown --save article.md
Files
5 totalSelect a file
Select a file to preview.
Comments
Loading comments…
