Skills jimliu baoyu-skills

baoyu-danger-x-to-markdown

Use it when:
You want a tweet, a thread or an X Article saved as a Markdown file.
It does:
Fetches it with its bundled script through a reverse-engineered X API, signed in with your X cookies.
You get:
A Markdown file under x-to-markdown/<username>/<tweet-id>/, with the URL, author, tweet count and cover image in its front matter.
Asks first:
Shows a disclaimer about the unofficial API (it may break, your account may be restricted) and stops unless you accept.
Media:
When the post has images or videos, asks whether to download them and relink them locally, unless your preferences already say.
Needs:
Bun or npx, and an X login: two cookie values in environment variables, or Chrome to log in once.
Unlike url-to-markdown:
baoyu-url-to-markdown, from the same repo, captures pages in Chrome; this one calls an X API directly with your cookies.

Uses an unofficial, reverse-engineered X API with your login cookies: it may break, and X may restrict your account.

TL;DR

It relies on a reverse-engineered X API rather than an official one. Before the first conversion it shows a disclaimer and saves your acceptance in a consent file; declining stops it. Also before its first conversion, it asks about downloading media, the output folder and where to keep these preferences, and never assumes defaults. It takes x.com and twitter.com status links and X Article links, and can print JSON instead of Markdown. Cookies come from the X_AUTH_TOKEN and X_CT0 environment variables or, failing those, from a Chrome window it opens for you to log in, whose cookies it caches locally; --login only refreshes them. When media downloading is left on ask, it saves the Markdown first, checks it for remote images or videos, and only then asks, rerunning with downloads if you say yes.

Summarizes the skill at ca703c2.

npx skills add https://github.com/jimliu/baoyu-skills --skill baoyu-danger-x-to-markdown
Total Downloads
28,300 on skills.sh, Nov 9, 2026
Repo stars
27,397 jimliu/baoyu-skills
First seen
Jan 19, 2026 on skills.sh
Weekly Downloads
175
-34% over the 8 weeks to Nov 9
Weekly values
Week toInstalls
Sep 21264
Sep 2897
Oct 589
Oct 12147
Oct 19138
Oct 26137
Nov 2152
Nov 9175
Category

Drive browsers, scrape pages and search the web.

Everything for building software: planning, coding, debugging, design, frameworks, cloud, agents and skills.

Type

Operates a CLI, API, app or bundled script to get something done.

Effect

Its own steps create or change files, git state or local tools.

Needs

A specific command-line tool or desktop app must be installed, such as gh, agent-browser, LibreOffice, Obsidian or a vendor CLI.

An account, API key or paid plan with an outside service.

Publisher

Everyone else. Unverified vendor claims default to community.

Topics
Stack

SKILL.md

From jimliu/baoyu-skills at ca703c2. Checked daily, last changed Nov 6, 2026.

Frontmatter
name: baoyu-danger-x-to-markdown
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.
version: 1.117.3
metadata:
  openclaw:
    homepage: https://github.com/JimLiu/baoyu-skills#baoyu-danger-x-to-markdown
    requires:
      anyBins:
        - bun
        - npx

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):

  1. Prefer built-in user-input tools exposed by the current agent runtime — e.g., AskUserQuestion, request_user_input, clarify, ask_user, or any equivalent.
  2. 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.
  3. 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

  1. {baseDir} = this SKILL.md's directory; script = {baseDir}/scripts/main.ts
  2. ${BUN_X} = bun if installed; else npx -y bun if npx available; else suggest installing bun

Consent Requirement (before any conversion)

  1. 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
  2. accepted: true and disclaimerVersion: "1.0" → print Warning: Using reverse-engineered X API. Accepted on: <acceptedAt> and proceed.
  3. 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?
    
  4. Accept → write the consent file:
    {
      "version": 1,
      "accepted": true,
      "acceptedAt": "<ISO timestamp>",
      "disclaimerVersion": "1.0"
    }
    
  5. 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):

  1. Run without --download-media → markdown saved
  2. Check it for remote media (https:// image/video links); none → done, no prompt
  3. Otherwise ask (header "Media", question "Download N images/videos to local files?"): "Yes" — download to local directories / "No" — keep remote URLs
  4. Yes → rerun with --download-media (overwrites markdown with localized links)

Authentication

  1. Environment variables (preferred): X_AUTH_TOKEN, X_CT0
  2. Chrome login (fallback): auto-opens Chrome, caches cookies locally

Extension Support

Custom configurations via EXTEND.md — see Preferences above.