baoyu-danger-x-to-markdown

Converts X tweets, threads, and articles to markdown with YAML front matter.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/chhpt/skills --skill baoyu-danger-x-to-markdown-chhpt
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: baoyu-danger-x-to-markdown
Source: https://github.com/chhpt/skills/tree/main/skills/baoyu-danger-x-to-markdown
Command: npx skills add https://github.com/chhpt/skills --skill baoyu-danger-x-to-markdown-chhpt

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve? Saving X (Twitter) content for offline reading or archiving is difficult because tweets, threads, and long-form articles are locked behind the platform's dynamic web interface. This Skill converts X content into clean, portable markdown files with YAML front matter, including optional local media downloads. ## Core Features & Use Cases - Tweet and Thread Conversion: Fetches single tweets or full threads via X's internal GraphQL API and formats them as markdown with author, URL, and media metadata. - X Article Extraction: Extracts full long-form X Articles including headings, lists, quotes, code blocks, and embedded media. - Media Localization: Optionally downloads images and videos to local imgs/ and videos/ directories and rewrites markdown links to relative paths. - Use Case: A researcher finds a 15-tweet technical thread on X and wants it archived. They provide the URL, accept the one-time disclaimer, and receive a structured markdown file with all tweets numbered, quoted tweets formatted, and images saved locally. ## Quick Start Convert this tweet to markdown and save it with all images downloaded locally: https://x.com/username/status/1234567890

Frequently Asked Questions about baoyu-danger-x-to-markdown

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I convert a tweet or X thread to markdown?

Run the main script with the tweet URL using Bun: npx -y bun scripts/main.ts followed by the x.com or twitter.com status URL. The output markdown file is saved to ./x-to-markdown/{username}/{tweet-id}.md with YAML front matter containing the URL, author, and tweet count.

How do I download images and videos from tweets locally?

Pass the --download-media flag when running the script, or set download_media to 1 in EXTEND.md. Images are saved to an imgs/ directory and videos to videos/ next to the markdown file, and all remote media links are rewritten to local relative paths.

What authentication is required to fetch X content?

The script requires X auth cookies, preferably provided through the X_AUTH_TOKEN and X_CT0 environment variables. As a fallback, it launches Chrome via the DevTools Protocol so you can log in manually, then caches the cookies locally for future runs.

Does this tool use the official X API?

No, it uses a reverse-engineered internal GraphQL API, which is why it requires explicit user consent before first use. The API may break if X changes its endpoints, and usage carries risks including possible account restrictions.

Why does tweet conversion fail with a missing cookies error?

The error occurs when neither the X_AUTH_TOKEN and X_CT0 environment variables are set nor a valid cached cookie file exists. Run the script with the --login flag to refresh cookies through a Chrome login session, then retry the conversion.