baoyu-danger-x-to-markdown
Converts X (Twitter) tweets and articles to markdown with YAML front matter. Uses reverse-engineered API requiring user consent. Use when user mentions "X to markdown", "tweet to markdown", "save tweet", or provides x.com/twitter.com URLs for conversion.
- License 许可
- MIT
- 最近更新
- 2026-11-11
- Stars
- ★ 2
- Forks
- 0
01 前言 Front Matter
- name
- baoyu-danger-x-to-markdown
- metadata
- { "openclaw": { "homepage": "https://github.com/JimLiu/baoyu-skills#baoyu-danger-x-to-markdown", "requires": { "anyBins": [ "bun", "npx" ] } }, "upstream-version": "1.117.3" }
- description
- Converts X (Twitter) tweets and articles to markdown with YAML front matter. Uses reverse-engineered API requiring user consent. Use when user mentions "X to markdown", "tweet to markdown", "save tweet", or provides x.com/twitter.com URLs for conversion.
02 资源文件 21
- 参考文档INSTALL-SOURCE.json573 B
- 许可证LICENSE1.0 KB
- 参考文档references/config/first-time-setup.md1.9 KB
- 脚本scripts/bun.lock392 B
- 脚本scripts/constants.ts6.6 KB
- 脚本scripts/cookie-file.ts2.4 KB
- 脚本scripts/cookies.ts9.3 KB
- 脚本scripts/graphql.ts12.6 KB
- 脚本scripts/http.ts3.4 KB
- 脚本scripts/main.ts18.6 KB
- 脚本scripts/markdown.test.ts4.7 KB
- 脚本scripts/markdown.ts20.6 KB
- 脚本scripts/media-localizer.ts10.2 KB
- 脚本scripts/package.json148 B
- 脚本scripts/paths.ts2.2 KB
- 脚本scripts/referenced-tweets.ts2.2 KB
- 脚本scripts/thread-markdown.ts8.0 KB
- 脚本scripts/thread.ts8.7 KB
- 脚本scripts/tweet-article.ts2.9 KB
- 脚本scripts/tweet-to-markdown.ts6.2 KB
- 脚本scripts/types.ts1.5 KB
03 SKILL.md 正文
X to Markdown
Tweets/threads → markdown with YAML front matter; X Articles → full content.
User Input Tools
When this skill prompts the user, follow this tool-selection rule (priority order):
- Prefer built-in user-input tools exposed by the current agent runtime — e.g.,
AskUserQuestion,request_user_input,clarify,ask_user, or any equivalent. - Fallback: if no such tool exists, emit a numbered plain-text message and ask the user to reply with the chosen number/answer for each question.
- Batching: if the tool supports multiple questions per call, combine all applicable questions into a single call; if only single-question, ask them one at a time in priority order.
Concrete AskUserQuestion references below are examples — substitute the local equivalent in other runtimes.
Script Directory
{baseDir}= this SKILL.md's directory; script ={baseDir}/scripts/main.ts${BUN_X}=bunif installed; elsenpx -y bunifnpxavailable; else suggest installing bun
Consent Requirement (before any conversion)
- Read the consent file:
- macOS:
~/Library/Application\ Support/baoyu-skills/x-to-markdown/consent.json - Linux:
~/.local/share/baoyu-skills/x-to-markdown/consent.json
- macOS:
accepted: trueanddisclaimerVersion: "1.0"→ printWarning: Using reverse-engineered X API. Accepted on: <acceptedAt>and proceed.- Missing or version mismatch → show this disclaimer and ask "Yes, I accept" | "No, I decline":
DISCLAIMER This tool uses a reverse-engineered X API, NOT official. Risks: - May break if X changes API - No guarantees or support - Possible account restrictions - Use at your own risk Accept terms and continue? - Accept → write the consent file:
{ "version": 1, "accepted": true, "acceptedAt": "<ISO timestamp>", "disclaimerVersion": "1.0" } - Decline → output "User declined. Exiting." and stop.
Preferences (EXTEND.md)
First one found wins:
| Priority | Path | Scope |
|---|---|---|
| 1 | .baoyu-skills/baoyu-danger-x-to-markdown/EXTEND.md |
Project |
| 2 | ${XDG_CONFIG_HOME:-$HOME/.config}/baoyu-skills/baoyu-danger-x-to-markdown/EXTEND.md |
XDG |
| 3 | $HOME/.baoyu-skills/baoyu-danger-x-to-markdown/EXTEND.md |
User home |
Found → read and apply. Not found → BLOCKING first-time setup: ask the questions in references/config/first-time-setup.md (Media, Output, Save — all in one call) before any conversion, write EXTEND.md at the chosen location, confirm "Preferences saved to [path]", then continue. Never create EXTEND.md with defaults without asking.
| Key | Default | Values |
|---|---|---|
download_media |
ask |
ask (prompt each time) / 1 (always) / 0 (never) |
default_output_dir |
empty (= ./x-to-markdown/) |
path or empty |
Value priority: CLI arguments (--download-media, -o) → EXTEND.md → skill defaults.
Usage
${BUN_X} {baseDir}/scripts/main.ts <url>
${BUN_X} {baseDir}/scripts/main.ts <url> -o output.md
${BUN_X} {baseDir}/scripts/main.ts <url> --download-media
${BUN_X} {baseDir}/scripts/main.ts <url> --json
| Option | Description |
|---|---|
<url> |
Tweet or article URL |
-o <path> |
Output path |
--json |
JSON output |
--download-media |
Download images/videos to local imgs/ and videos/ next to the markdown, rewrite links to local relative paths |
--login |
Refresh cookies only |
Supported URLs: https://x.com/<user>/status/<id>, https://twitter.com/<user>/status/<id>, https://x.com/i/article/<id>
Output
---
url: "https://x.com/user/status/123"
author: "Name (@user)"
tweetCount: 3
coverImage: "https://pbs.twimg.com/media/example.jpg"
---
Content...
File structure: x-to-markdown/{username}/{tweet-id}/{content-slug}.md
Media Download
By EXTEND.md download_media: 1 → run with --download-media; 0 → run without; ask (default):
- Run without
--download-media→ markdown saved - Check it for remote media (
https://image/video links); none → done, no prompt - Otherwise ask (header "Media", question "Download N images/videos to local files?"): "Yes" — download to local directories / "No" — keep remote URLs
- Yes → rerun with
--download-media(overwrites markdown with localized links)
Authentication
- Environment variables (preferred):
X_AUTH_TOKEN,X_CT0 - Chrome login (fallback): auto-opens Chrome, caches cookies locally
Extension Support
Custom configurations via EXTEND.md — see Preferences above.
04 同仓库更多 Skills
xlsx
Use this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved.
writing-shape
Writing, exploit: shape raw material into an article, paragraph by paragraph.
writing-fragments
Writing, explore: mine raw fragments, no structure yet.
writing-for-agents
Writing documents for agents. Use when creating or editing skills, or modifying AGENTS.md or CLAUDE.md.
writing-clearly-and-concisely
Use when writing prose humans will read—documentation, commit messages, error messages, explanations, reports, or UI text. Applies Strunk's timeless rules for clearer, stronger, more professional writing.
writing-beats
Writing, exploit; assemble raw material into a journey of beats, grounding each term before a beat leans on it.