# Fetch Xcom

> Fetch X/Twitter tweet content via oembed API and save as markdown to ~/ai/see/xcom/{MMDD}_{id}.md. Triggers on x.com or twitter.com URLs when user wants to pull/save/拉取 a tweet.

- Skill: `luw2007/fetch-xcom` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add luw2007/fetch-xcom`
- Raw SKILL.md: https://api.skillmd.com/api/skills/luw2007/fetch-xcom/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Docs & Writing
- Author: luw2007 (https://skillmd.com/u/luw2007)
- Updated: 2026-09-10
- Page: https://skillmd.com/skills/luw2007/fetch-xcom

---


# 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

1. Extract tweet ID from URL (the numeric suffix after `/status/`)
2. Fetch via oembed:
   ```bash
   curl -s "https://publish.twitter.com/oembed?url=https://x.com/i/status/{TWEET_ID}"
   ```
3. Parse the JSON response — extract `author_name`, `author_url`, and HTML content from `html` field
4. Strip HTML tags from the `html` field to get plain text content
5. Save to `~/ai/see/xcom/{MMDD}_{TWEET_ID}.md` with format:

```markdown
---
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 `html` field 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

