{"slug":"baoyu-url-to-markdown","title":"\u7f51\u9875\u8f6c Markdown","description":"\u7528 baoyu-fetch \u6293\u53d6\u4efb\u610f\u7f51\u9875\u5e76\u8f6c\u6210 Markdown\uff0c\u5185\u7f6e\u7ad9\u70b9\u9002\u914d\u5668\u3002","category":"\u7d20\u6750\u4e0e\u6548\u7387","tags":["\u7d20\u6750","Markdown","\u91c7\u96c6"],"author":"\u5b9d\u7389","source_url":"https://github.com/JimLiu/baoyu-skills/blob/main/skills/baoyu-url-to-markdown/SKILL.md","license":"MIT","status":"published","verification":"source_reviewed","verification_notes":"\u6765\u6e90 JimLiu/baoyu-skills\uff08skills/baoyu-url-to-markdown/SKILL.md\uff09\uff0c\u672c\u5730\u6253\u5305\u4e0a\u4f20\uff1b\u672a\u6267\u884c\u5305\u5185\u811a\u672c\u3002","revision":"c284b0523b7741bf82b678862d367ca6","created_at":"2026-10-28T08:05:07+00:00","updated_at":"2026-10-28T08:05:16+00:00","source_repo":"","source_path":"","source_commit":"","source_updated_at":"","stars":0,"proxy_score":null,"score":null,"grade":null,"dimensions":{},"evaluation":{},"installs":0,"platforms":[],"formats":[],"category_slug":"workflow","category_name":"\u7d20\u6750\u4e0e\u6548\u7387","usage_guide":{},"read_url":"https://shiliuai.cn/api/v2/skills/baoyu-url-to-markdown","skill_url":"https://shiliuai.cn/api/v2/skills/baoyu-url-to-markdown/files/SKILL.md","download_url":"https://shiliuai.cn/api/v2/skills/baoyu-url-to-markdown/download","install_url":"https://shiliuai.cn/api/v2/skills/baoyu-url-to-markdown/install","files":[{"path":"SKILL.md","bytes":8520,"url":"https://shiliuai.cn/api/v2/skills/baoyu-url-to-markdown/files/SKILL.md"},{"path":"references/adapters.md","bytes":3231,"url":"https://shiliuai.cn/api/v2/skills/baoyu-url-to-markdown/files/references/adapters.md"},{"path":"references/config/first-time-setup.md","bytes":2459,"url":"https://shiliuai.cn/api/v2/skills/baoyu-url-to-markdown/files/references/config/first-time-setup.md"},{"path":"references/quality-gate.md","bytes":2490,"url":"https://shiliuai.cn/api/v2/skills/baoyu-url-to-markdown/files/references/quality-gate.md"},{"path":"scripts/baoyu-fetch","bytes":122,"url":"https://shiliuai.cn/api/v2/skills/baoyu-url-to-markdown/files/scripts/baoyu-fetch"},{"path":"scripts/bun.lock","bytes":35416,"url":"https://shiliuai.cn/api/v2/skills/baoyu-url-to-markdown/files/scripts/bun.lock"},{"path":"scripts/lib/adapters/generic/index.ts","bytes":2451,"url":"https://shiliuai.cn/api/v2/skills/baoyu-url-to-markdown/files/scripts/lib/adapters/generic/index.ts"},{"path":"scripts/lib/adapters/hn/index.ts","bytes":10454,"url":"https://shiliuai.cn/api/v2/skills/baoyu-url-to-markdown/files/scripts/lib/adapters/hn/index.ts"},{"path":"scripts/lib/adapters/index.ts","bytes":834,"url":"https://shiliuai.cn/api/v2/skills/baoyu-url-to-markdown/files/scripts/lib/adapters/index.ts"},{"path":"scripts/lib/adapters/types.ts","bytes":2100,"url":"https://shiliuai.cn/api/v2/skills/baoyu-url-to-markdown/files/scripts/lib/adapters/types.ts"},{"path":"scripts/lib/adapters/x/article.ts","bytes":12677,"url":"https://shiliuai.cn/api/v2/skills/baoyu-url-to-markdown/files/scripts/lib/adapters/x/article.ts"},{"path":"scripts/lib/adapters/x/index.ts","bytes":4048,"url":"https://shiliuai.cn/api/v2/skills/baoyu-url-to-markdown/files/scripts/lib/adapters/x/index.ts"},{"path":"scripts/lib/adapters/x/login.ts","bytes":2258,"url":"https://shiliuai.cn/api/v2/skills/baoyu-url-to-markdown/files/scripts/lib/adapters/x/login.ts"},{"path":"scripts/lib/adapters/x/match.ts","bytes":297,"url":"https://shiliuai.cn/api/v2/skills/baoyu-url-to-markdown/files/scripts/lib/adapters/x/match.ts"},{"path":"scripts/lib/adapters/x/payloads.ts","bytes":1681,"url":"https://shiliuai.cn/api/v2/skills/baoyu-url-to-markdown/files/scripts/lib/adapters/x/payloads.ts"},{"path":"scripts/lib/adapters/x/session.ts","bytes":1404,"url":"https://shiliuai.cn/api/v2/skills/baoyu-url-to-markdown/files/scripts/lib/adapters/x/session.ts"},{"path":"scripts/lib/adapters/x/shared.ts","bytes":12980,"url":"https://shiliuai.cn/api/v2/skills/baoyu-url-to-markdown/files/scripts/lib/adapters/x/shared.ts"},{"path":"scripts/lib/adapters/x/single.ts","bytes":2583,"url":"https://shiliuai.cn/api/v2/skills/baoyu-url-to-markdown/files/scripts/lib/adapters/x/single.ts"},{"path":"scripts/lib/adapters/x/thread-loader.ts","bytes":9078,"url":"https://shiliuai.cn/api/v2/skills/baoyu-url-to-markdown/files/scripts/lib/adapters/x/thread-loader.ts"},{"path":"scripts/lib/adapters/x/thread.ts","bytes":9196,"url":"https://shiliuai.cn/api/v2/skills/baoyu-url-to-markdown/files/scripts/lib/adapters/x/thread.ts"},{"path":"scripts/lib/adapters/x/types.ts","bytes":600,"url":"https://shiliuai.cn/api/v2/skills/baoyu-url-to-markdown/files/scripts/lib/adapters/x/types.ts"},{"path":"scripts/lib/adapters/youtube/index.ts","bytes":898,"url":"https://shiliuai.cn/api/v2/skills/baoyu-url-to-markdown/files/scripts/lib/adapters/youtube/index.ts"},{"path":"scripts/lib/adapters/youtube/transcript.ts","bytes":13301,"url":"https://shiliuai.cn/api/v2/skills/baoyu-url-to-markdown/files/scripts/lib/adapters/youtube/transcript.ts"},{"path":"scripts/lib/adapters/youtube/utils.ts","bytes":6523,"url":"https://shiliuai.cn/api/v2/skills/baoyu-url-to-markdown/files/scripts/lib/adapters/youtube/utils.ts"},{"path":"scripts/lib/browser/cdp-client.ts","bytes":6879,"url":"https://shiliuai.cn/api/v2/skills/baoyu-url-to-markdown/files/scripts/lib/browser/cdp-client.ts"},{"path":"scripts/lib/browser/chrome-launcher.ts","bytes":5883,"url":"https://shiliuai.cn/api/v2/skills/baoyu-url-to-markdown/files/scripts/lib/browser/chrome-launcher.ts"},{"path":"scripts/lib/browser/cookie-sidecar.ts","bytes":2941,"url":"https://shiliuai.cn/api/v2/skills/baoyu-url-to-markdown/files/scripts/lib/browser/cookie-sidecar.ts"},{"path":"scripts/lib/browser/interaction-gates.ts","bytes":4095,"url":"https://shiliuai.cn/api/v2/skills/baoyu-url-to-markdown/files/scripts/lib/browser/interaction-gates.ts"},{"path":"scripts/lib/browser/network-journal.ts","bytes":7153,"url":"https://shiliuai.cn/api/v2/skills/baoyu-url-to-markdown/files/scripts/lib/browser/network-journal.ts"},{"path":"scripts/lib/browser/page-snapshot.ts","bytes":3429,"url":"https://shiliuai.cn/api/v2/skills/baoyu-url-to-markdown/files/scripts/lib/browser/page-snapshot.ts"},{"path":"scripts/lib/browser/profile.ts","bytes":5670,"url":"https://shiliuai.cn/api/v2/skills/baoyu-url-to-markdown/files/scripts/lib/browser/profile.ts"},{"path":"scripts/lib/browser/session.ts","bytes":4642,"url":"https://shiliuai.cn/api/v2/skills/baoyu-url-to-markdown/files/scripts/lib/browser/session.ts"},{"path":"scripts/lib/cli.ts","bytes":7066,"url":"https://shiliuai.cn/api/v2/skills/baoyu-url-to-markdown/files/scripts/lib/cli.ts"},{"path":"scripts/lib/commands/convert.ts","bytes":17456,"url":"https://shiliuai.cn/api/v2/skills/baoyu-url-to-markdown/files/scripts/lib/commands/convert.ts"},{"path":"scripts/lib/extract/document.ts","bytes":846,"url":"https://shiliuai.cn/api/v2/skills/baoyu-url-to-markdown/files/scripts/lib/extract/document.ts"},{"path":"scripts/lib/extract/html-cleaner.ts","bytes":11016,"url":"https://shiliuai.cn/api/v2/skills/baoyu-url-to-markdown/files/scripts/lib/extract/html-cleaner.ts"},{"path":"scripts/lib/extract/html-extractor.ts","bytes":2243,"url":"https://shiliuai.cn/api/v2/skills/baoyu-url-to-markdown/files/scripts/lib/extract/html-extractor.ts"},{"path":"scripts/lib/extract/html-to-markdown.ts","bytes":21344,"url":"https://shiliuai.cn/api/v2/skills/baoyu-url-to-markdown/files/scripts/lib/extract/html-to-markdown.ts"},{"path":"scripts/lib/extract/markdown-renderer.ts","bytes":4661,"url":"https://shiliuai.cn/api/v2/skills/baoyu-url-to-markdown/files/scripts/lib/extract/markdown-renderer.ts"},{"path":"scripts/lib/media/default-downloader.ts","bytes":5215,"url":"https://shiliuai.cn/api/v2/skills/baoyu-url-to-markdown/files/scripts/lib/media/default-downloader.ts"},{"path":"scripts/lib/media/markdown-media.ts","bytes":13186,"url":"https://shiliuai.cn/api/v2/skills/baoyu-url-to-markdown/files/scripts/lib/media/markdown-media.ts"},{"path":"scripts/lib/media/media-utils.ts","bytes":6222,"url":"https://shiliuai.cn/api/v2/skills/baoyu-url-to-markdown/files/scripts/lib/media/media-utils.ts"},{"path":"scripts/lib/media/types.ts","bytes":710,"url":"https://shiliuai.cn/api/v2/skills/baoyu-url-to-markdown/files/scripts/lib/media/types.ts"},{"path":"scripts/lib/types/defuddle-node.d.ts","bytes":605,"url":"https://shiliuai.cn/api/v2/skills/baoyu-url-to-markdown/files/scripts/lib/types/defuddle-node.d.ts"},{"path":"scripts/lib/types/shims.d.ts","bytes":422,"url":"https://shiliuai.cn/api/v2/skills/baoyu-url-to-markdown/files/scripts/lib/types/shims.d.ts"},{"path":"scripts/lib/utils/logger.ts","bytes":645,"url":"https://shiliuai.cn/api/v2/skills/baoyu-url-to-markdown/files/scripts/lib/utils/logger.ts"},{"path":"scripts/lib/utils/url.ts","bytes":300,"url":"https://shiliuai.cn/api/v2/skills/baoyu-url-to-markdown/files/scripts/lib/utils/url.ts"},{"path":"scripts/package.json","bytes":557,"url":"https://shiliuai.cn/api/v2/skills/baoyu-url-to-markdown/files/scripts/package.json"}],"content":"---\nname: baoyu-url-to-markdown\ndescription: Fetch any URL and convert to markdown using baoyu-fetch CLI (Chrome CDP with site-specific adapters). Built-in adapters for X/Twitter, YouTube transcripts, Hacker News threads, and generic pages via Defuddle. Handles login/CAPTCHA via interaction wait modes. Use when user wants to save a webpage as markdown.\nversion: 1.61.0\nmetadata:\n  openclaw:\n    homepage: https://github.com/JimLiu/baoyu-skills#baoyu-url-to-markdown\n    requires:\n      anyBins:\n        - bun\n---\n\n# URL to Markdown\n\nFetches any URL via `baoyu-fetch` CLI (Chrome CDP + site-specific adapters) and converts it to clean markdown.\n\n## User Input Tools\n\nWhen this skill prompts the user, follow this tool-selection rule (priority order):\n\n1. **Prefer built-in user-input tools** exposed by the current agent runtime \u2014 e.g., `AskUserQuestion`, `request_user_input`, `clarify`, `ask_user`, or any equivalent.\n2. **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.\n3. **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.\n\nConcrete `AskUserQuestion` references below are examples \u2014 substitute the local equivalent in other runtimes.\n\n## CLI Setup\n\n**Important**: The CLI source is vendored in `{baseDir}/scripts/lib`. `scripts/package.json` installs only third-party runtime dependencies.\n\n**Agent Execution Instructions**:\n1. Determine this SKILL.md file's directory path as `{baseDir}`\n2. Resolve `${BUN}` runtime: if `bun` installed \u2192 `bun`; else suggest installing Bun\n3. If `{baseDir}/scripts/node_modules` does not exist, run `${BUN} install --cwd {baseDir}/scripts`\n4. `${READER}` = `{baseDir}/scripts/baoyu-fetch`\n5. Replace all `${READER}` in this document with the resolved value\n\n## Preferences (EXTEND.md)\n\nCheck EXTEND.md in priority order \u2014 the first one found wins:\n\n| Priority | Path | Scope |\n|----------|------|-------|\n| 1 | `.baoyu-skills/baoyu-url-to-markdown/EXTEND.md` | Project |\n| 2 | `${XDG_CONFIG_HOME:-$HOME/.config}/baoyu-skills/baoyu-url-to-markdown/EXTEND.md` | XDG |\n| 3 | `$HOME/.baoyu-skills/baoyu-url-to-markdown/EXTEND.md` | User home |\n\n| Result | Action |\n|--------|--------|\n| Found | Read, parse, apply settings |\n| Not found | **MUST** run first-time setup (see below) \u2014 do NOT silently create defaults |\n\n**EXTEND.md supports**: download media by default, default output directory.\n\n### First-Time Setup \u26d4 BLOCKING\n\nWhen EXTEND.md is not found, you **MUST** use `AskUserQuestion` to gather preferences before creating EXTEND.md. **NEVER** create EXTEND.md with silent defaults. Generation is BLOCKED until setup completes. Batch all three questions into a single call:\n\n- **Q1 \u2014 Media** (header \"Media\"): \"How to handle images and videos in pages?\"\n  - \"Ask each time (Recommended)\" \u2014 Prompt after each save\n  - \"Always download\" \u2014 Download to local `imgs/` and `videos/`\n  - \"Never download\" \u2014 Keep remote URLs\n- **Q2 \u2014 Output** (header \"Output\"): \"Default output directory?\"\n  - \"url-to-markdown (Recommended)\" \u2014 Save to `./url-to-markdown/{domain}/{slug}.md`\n  - User may pick \"Other\" and type a custom path\n- **Q3 \u2014 Save** (header \"Save\"): \"Where to save preferences?\"\n  - \"User (Recommended)\" \u2014 `~/.baoyu-skills/` (all projects)\n  - \"Project\" \u2014 `.baoyu-skills/` (this project only)\n\nAfter answers, write EXTEND.md, confirm \"Preferences saved to [path]\", then continue.\n\nFull template: [references/config/first-time-setup.md](references/config/first-time-setup.md).\n\n### Supported Keys\n\n| Key | Default | Values | Description |\n|-----|---------|--------|-------------|\n| `download_media` | `ask` | `ask` / `1` / `0` | `ask` = prompt each time, `1` = always, `0` = never |\n| `default_output_dir` | empty | path or empty | Default output directory (empty = `./url-to-markdown/`) |\n\n**EXTEND.md \u2192 CLI mapping**:\n\n| EXTEND.md key | CLI argument | Notes |\n|---------------|-------------|-------|\n| `download_media: 1` | `--download-media` | Requires `--output` to be set |\n| `default_output_dir: ./posts/` | Agent constructs `--output ./posts/{domain}/{slug}.md` | Agent generates path, not a direct flag |\n\n**Value priority**: CLI arguments \u2192 EXTEND.md \u2192 skill defaults.\n\n## Usage\n\n```bash\n# Default: headless capture, markdown to stdout\n${READER} <url>\n\n# Save to file\n${READER} <url> --output article.md\n\n# Save with media download\n${READER} <url> --output article.md --download-media\n\n# Wait for interaction (login/CAPTCHA) \u2014 auto-detect and continue\n${READER} <url> --wait-for interaction --output article.md\n\n# Wait for interaction \u2014 manual control (Enter to continue)\n${READER} <url> --wait-for force --output article.md\n\n# JSON output\n${READER} <url> --format json --output article.json\n\n# Force specific adapter\n${READER} <url> --adapter youtube --output transcript.md\n```\n\n## Options\n\n| Option | Description |\n|--------|-------------|\n| `<url>` | URL to fetch |\n| `--output <path>` | Output file path (default: stdout) |\n| `--format <type>` | Output format: `markdown` (default) or `json` |\n| `--json` | Shorthand for `--format json` |\n| `--adapter <name>` | Force adapter: `x`, `youtube`, `hn`, or `generic` (default: auto-detect) |\n| `--headless` | Force headless Chrome (no visible window) |\n| `--wait-for <mode>` | Interaction wait mode: `none` (default), `interaction`, or `force` |\n| `--wait-for-interaction` | Alias for `--wait-for interaction` |\n| `--wait-for-login` | Alias for `--wait-for interaction` |\n| `--timeout <ms>` | Page load timeout (default: 30000) |\n| `--interaction-timeout <ms>` | Login/CAPTCHA wait timeout (default: 600000 = 10 min) |\n| `--interaction-poll-interval <ms>` | Poll interval for interaction checks (default: 1500) |\n| `--download-media` | Download images/videos to local `imgs/` and `videos/`, rewrite markdown links. Requires `--output` |\n| `--media-dir <dir>` | Base directory for downloaded media (default: same as `--output` directory) |\n| `--cdp-url <url>` | Reuse existing Chrome DevTools Protocol endpoint |\n| `--browser-path <path>` | Custom Chrome/Chromium binary path |\n| `--chrome-profile-dir <path>` | Chrome user data directory (default: `BAOYU_CHROME_PROFILE_DIR` env or `./baoyu-skills/chrome-profile`) |\n| `--debug-dir <dir>` | Write debug artifacts (document.json, markdown.md, page.html, network.json) |\n\n## Agent Quality Gate\n\n**CRITICAL**: treat default headless capture as provisional. Some sites render differently in headless mode and can silently return low-quality content without failing the CLI.\n\nAfter every headless run, inspect the saved markdown. See [references/quality-gate.md](references/quality-gate.md) for the full checklist, recovery workflow, and capture-mode table. Read it whenever a run looks suspicious or the user asks about login/CAPTCHA handling.\n\n## Output Path Generation\n\nThe agent must construct the output file path \u2014 `baoyu-fetch` does not auto-generate paths.\n\n**Algorithm**:\n1. Determine base directory from EXTEND.md `default_output_dir` or default `./url-to-markdown/`\n2. Extract domain from URL (e.g., `example.com`)\n3. Generate slug from URL path or page title (kebab-case, 2-6 words)\n4. Construct: `{base_dir}/{domain}/{slug}/{slug}.md` \u2014 each URL gets its own directory so media files stay isolated\n5. Conflict resolution: append timestamp `{slug}-YYYYMMDD-HHMMSS/{slug}-YYYYMMDD-HHMMSS.md`\n\nPass the constructed path to `--output`. Media files (`--download-media`) are saved into subdirectories next to the markdown file, keeping each URL's assets self-contained.\n\n## Adapters & Media\n\nSee [references/adapters.md](references/adapters.md) for the adapter catalog (X, YouTube, Hacker News, generic), per-adapter notes, the media download flow (`ask` / always / never), and the JSON output schema. Read it before answering adapter-specific questions or handling media prompts.\n\n## Environment Variables\n\n| Variable | Description |\n|----------|-------------|\n| `BAOYU_CHROME_PROFILE_DIR` | Chrome user data directory (can also use `--chrome-profile-dir`) |\n\n**Troubleshooting**: Chrome not found \u2192 use `--browser-path`. Timeout \u2192 increase `--timeout`. Login/CAPTCHA \u2192 `--wait-for interaction`. Debug \u2192 `--debug-dir` to inspect captured HTML and network logs.\n\n## Extension Support\n\nCustom configurations via EXTEND.md. See **Preferences** section above for paths and supported keys.\n","usage":"\u8bfb\u53d6 SKILL.md\uff0c\u5e76\u6309\u9700\u8bfb\u53d6\u914d\u5957\u6587\u4ef6\uff1b\u4e0b\u8f7d ZIP \u83b7\u53d6\u5b8c\u6574\u5305\u3002\u6280\u80fd\u662f\u4efb\u52a1\u65b9\u6cd5\uff0c\u4e0d\u6388\u4e88\u65b0\u589e\u8d26\u6237\u3001\u4ed8\u8d39\u6216\u7cfb\u7edf\u6743\u9650\u3002"}
