Fetch X.com Tweet
Pull tweet text via the public oembed endpoint (no auth needed) and persist to local archive.
When to Activate
- User shares an x.com or twitter.com status URL and says "拉取", "pull", "fetch", "save"
- User wants to archive a tweet locally
Procedure
- Extract tweet ID from URL (the numeric suffix after
/status/) - Fetch via oembed:
curl -s "https://publish.twitter.com/oembed?url=https://x.com/i/status/{TWEET_ID}" - Parse the JSON response — extract
author_name,author_url, and HTML content fromhtmlfield - Strip HTML tags from the
htmlfield to get plain text content - Save to
~/ai/see/xcom/{MMDD}_{TWEET_ID}.mdwith format:
---
id: "{TWEET_ID}"
author: "{author_name}"
author_url: "{author_url}"
url: "{original_url}"
date: "{YYYY-MM-DD}"
---
{cleaned tweet text}
Notes
- oembed API is public, no bearer token required
- The
htmlfield contains the tweet text inside<p>tags;<br>→ newline, strip other tags - If oembed returns error/empty, report failure — the tweet may be protected or deleted
- Date in filename uses fetch date (today), not tweet creation date (unless parseable from response)
- Create
~/ai/see/xcom/if it doesn't exist