| name | fetch-twitter |
| description | Fetch tweet content using Twitter's syndication API (no auth required). Use when processing Twitter/X URLs to get tweet text, author info, and metadata. |
| allowed-tools | ["Bash"] |
Fetch Twitter/X Content
Fetch tweet content using Twitter's syndication API (the same endpoint used for tweet embeds).
Quick Usage
bun ~/.config/opencode/skill/fetch-twitter/fetch-twitter.js <tweet_url_or_id>
Examples
bun ~/.config/opencode/skill/fetch-twitter/fetch-twitter.js https://x.com/shanselman/status/2006301298933604666
bun ~/.config/opencode/skill/fetch-twitter/fetch-twitter.js 2006301298933604666
Output Format
{
"id": "2006301298933604666",
"url": "https://x.com/shanselman/status/2006301298933604666",
"author": {
"name": "Scott Hanselman",
"handle": "@shanselman",
"verified": true
},
"text": "Full tweet text...",
"created": "2025-12-31T09:47:59.000Z",
"favorites": 389,
"hasMedia": false,
"mediaType": null,
"quotedTweet": {
"author": "@davidfowl",
"text": "Quoted tweet text...",
"url": "https://x.com/davidfowl/status/..."
}
}
How It Works
Twitter's syndication API (cdn.syndication.twimg.com) is used for tweet embeds and doesn't require authentication. It requires a token calculated from the tweet ID:
function getToken(id) {
return ((Number(id) / 1e15) * Math.PI)
.toString(36)
.replace(/(0+|\.)/g, '');
}
The endpoint is: https://cdn.syndication.twimg.com/tweet-result?id={tweetId}&token={token}
Limitations
- May occasionally fail (retry if needed)
- Rate limits are undocumented
- Could break if Twitter changes the embed system
- Does not fetch full threads, only the specific tweet (plus quoted tweet if present)
When to Use
When processing Twitter URLs:
- Detect
x.com or twitter.com URLs
- Run:
bun ~/.config/opencode/skill/fetch-twitter/fetch-twitter.js <url>
- Parse the JSON output
- Use
text, author.name, author.handle for the markdown entry
- Note
hasMedia and mediaType if relevant
- Include
quotedTweet context if present