x-fetcher
Original:🇨🇳 Chinese
Translated
4 scripts
A command-line tool for fetching X (Twitter) tweets and long-form articles. Supports regular tweets (text, images, video links) and X Article long-form articles (full content in Markdown format), and automatically saves as Markdown files. Based on the Jane-xiaoer/x-fetcher project. Use when user mentions "fetch tweet", "download tweet", "save X article", "fetch tweet", or provides x.com/twitter.com URLs.
5installs
Sourcewlzh/skills
Added on
NPX Install
npx skill4agent add wlzh/skills x-fetcherTags
Translated version includes tags in frontmatterSKILL.md Content (Chinese)
View Translation Comparison →X Fetcher
A command-line tool for fetching X (Twitter) post content, supporting regular tweets and X Article long-form articles, and automatically saving as Markdown format.
Engineering Source: This Skill is based on the Jane-xiaoer/x-fetcher project.
Features
- Fetch regular tweets (text, images, video links)
- Fetch X Article long-form articles (full content in Markdown format)
- Get interaction data (likes, retweets, views, bookmark counts)
- Automatically save as formatted Markdown files
- Configurable default download directory
Script Directory
Scripts are located in the subdirectory.
scripts/Path Resolution:
- = Directory where this SKILL.md file is located
SKILL_DIR - Script path =
${SKILL_DIR}/scripts/main.py
Preferences (EXTEND.md)
Use Bash to check if EXTEND.md exists (priority order):
bash
# Check project-level first
test -f .x-fetcher/EXTEND.md && echo "project"
# Then check user-level (cross-platform: $HOME works for macOS/Linux/WSL)
test -f "$HOME/.x-fetcher/EXTEND.md" && echo "user"┌────────────────────────────────────┬───────────────────┐
│ Path │ Location │
├────────────────────────────────────┼───────────────────┤
│ .x-fetcher/EXTEND.md │ Project directory │
├────────────────────────────────────┼───────────────────┤
│ $HOME/.x-fetcher/EXTEND.md │ User home directory │
└────────────────────────────────────┴───────────────────┘
┌───────────┬───────────────────────────────────────────────────────────────────────────┐
│ Result │ Action │
├───────────┼───────────────────────────────────────────────────────────────────────────┤
│ Found │ Read, parse, and apply settings │
├───────────┼───────────────────────────────────────────────────────────────────────────┤
│ Not found │ Must run initial setup (see below) — Do not silently create defaults │
└───────────┴───────────────────────────────────────────────────────────────────────────┘
EXTEND.md Support: Default download directory | Media handling method
Initial Setup (Blocking)
Key: When EXTEND.md is not found, you must use to ask the user for preferences before creating EXTEND.md. Never create EXTEND.md with default values without asking. This is a blocking operation — do not proceed with any conversion until setup is complete.
AskUserQuestionUse in one call to ask all questions:
AskUserQuestionQuestion 1 — header: "Download Directory", question: "Default directory path for saving tweets?"
- "x-fetcher (Recommended)" — Save to ./x-fetcher/{username}/{tweet-id}.md
- (User can select "Other" to enter a custom path)
Question 2 — header: "Save Location", question: "Where to save preferences?"
- "User (Recommended)" — ~/.x-fetcher/ (all projects)
- "Project" — .x-fetcher/ (this project only)
After the user answers, create EXTEND.md at the selected location, confirm "Preferences saved to [path]", then proceed.
Supported Configuration Keys
| Key | Default Value | Optional Values | Description |
|---|---|---|---|
| Empty | Path or empty | Default output directory (empty = |
| | | Automatically save Markdown files |
| | | Whether to download media files locally ( |
Value Priority:
- CLI parameters
- EXTEND.md
- Skill default values
Media Download Notes:
- When is set to
download_media, images are saved to thetruedirectory, videos to theimgs/directoryvideos/ - Media links in Markdown files are automatically updated to local relative paths
- Supported media formats: Images (jpg, png, gif, webp), Videos (mp4, mov, webm)
Usage
bash
python3 ${SKILL_DIR}/scripts/main.py <url>
python3 ${SKILL_DIR}/scripts/main.py <url> --output /path/to/save
python3 ${SKILL_DIR}/scripts/main.py <url> --download-media
python3 ${SKILL_DIR}/scripts/main.py <url> --jsonOptions
| Option | Description |
|---|---|
| Tweet or article URL |
| Output path (directory or file) |
| Download image/video resources to local |
| Output in JSON format (do not save Markdown) |
| Do not automatically save Markdown files |
Supported URLs
https://x.com/<user>/status/<id>https://twitter.com/<user>/status/<id>
Output
Regular Tweet
markdown
# Tweet from @username
> Author: **Author Name** (@username)
> Published: 2024-01-01 12:00:00
> Original Link: https://x.com/user/status/123
---
Tweet content...
## Media

---
## Interaction Data
- ❤️ Likes: 1,234
- 🔁 Retweets: 567
- 👀 Views: 89,000
- 💬 Replies: 123X Article Long-form Article
markdown
# Article Title
> Author: **Author Name** (@username)
> Published: 2024-01-01 12:00:00
> Updated: 2024-01-02 10:30:00
> Original Link: https://x.com/user/status/123
---

Full article content (Markdown format)...
---
## Interaction Data
- ❤️ Likes: 206,351
- 🔁 Retweets: 28,631
- 👀 Views: 115,555,283
- 🔖 Bookmarks: 571,495File Structure:
{output_dir}/{username}/{tweet-id}.mdHow It Works
- Extract tweet ID from URL
- Try fxtwitter API (supports Articles)
- Fallback to syndication API
- Parse and format output
- Automatically save as Markdown file
Limitations
- Depends on third-party APIs (fxtwitter), which may fail due to service changes
- Cannot fetch content from private accounts
- Some media content may not have complete URLs available
Dependencies
- Python 3.6+
- requests >= 2.25.0
Dependencies are automatically checked on first use, and installation commands will be prompted if not installed.
Extension Support
Custom configurations are supported via EXTEND.md. See the Preferences section for paths and supported options.