Generate and edit Draw.io, Mermaid, and Excalidraw diagrams from natural language using a structured JSON spec.
Browser
Web to WeChat
Try it抓取任意网页内容,AI 智能整理格式,自动生成封面图和配图,发布到微信公众号草稿箱。支持微信公众号文章、新闻网站、技术博客、知乎、CSDN 等。Use when the user wants to scrape a web page and publish it to WeChat.
What it does
抓取**任意网页链接**的内容,AI 智能整理排版,自动生成封面图,发布到微信公众号草稿箱。
The skill document
Web to WeChat
抓取任意网页链接的内容,AI 智能整理排版,自动生成封面图,发布到微信公众号草稿箱。
User-Facing Promise
Accept requests like:
- "帮我抓取这个链接的内容,发到微信公众号"
- "把这篇文章转载到我的公众号"
- "抓取 https://xxx.com/article 发布到微信"
- "把这个网页内容整理成公众号文章"
- "帮我收藏这篇文章到我的公众号"
Return a published draft in the WeChat draft box, not a proposal.
First-Time Setup
1. Install Python Dependencies
python -m pip install requests beautifulsoup4 html2text markdown Pillow
2. Install Companion Skills
This skill depends on two companion skills from ClawHub:
clawhub install anything-to-wechat
clawhub install file-to-wechat
- anything-to-wechat — provides
publish_to_wechat.py(WeChat API publishing) - file-to-wechat — provides
md_to_wechat_html.py(Markdown → WeChat HTML)
3. Configure WeChat Credentials
You need a WeChat Official Account (服务号 or 订阅号 with API access).
Get your credentials:
- Log in to https://mp.weixin.qq.com/
- Go to: 设置与开发 → 基本配置
- Copy your AppID and reset/view AppSecret
- Add your server's public IP to the IP白名单
Set environment variables (recommended):
On macOS / Linux:
export WECHAT_APP_ID="your_appid_here"
export WECHAT_APP_SECRET="your_appsecret_here"
On Windows (PowerShell):
[Environment]::SetEnvironmentVariable("WECHAT_APP_ID", "your_appid_here", "User")
[Environment]::SetEnvironmentVariable("WECHAT_APP_SECRET", "your_appsecret_here", "User")
No environment variables? The publish script will prompt you interactively on first run.
Prerequisites
| Dependency | Required | Purpose |
|---|---|---|
requests (pip) | Yes | HTTP fetching |
beautifulsoup4 (pip) | Yes | HTML parsing |
html2text (pip) | Yes | HTML → Markdown conversion |
markdown (pip) | Yes | Markdown → HTML (via md_to_wechat_html.py) |
Pillow (pip) | Yes | Image compression |
| anything-to-wechat skill | Yes | WeChat API publishing |
| file-to-wechat skill | Yes | Markdown → WeChat HTML conversion |
Workflow
Phase 1: Collect Input
If the user has NOT provided a URL, ask using AskUserQuestion:
Question: "请提供你想抓取并发布到微信公众号的网页链接"
Options:
- "粘贴 URL"
- "搜索关键词后选择文章"
If the user already provided a URL, skip and proceed.
Phase 2: Scrape Web Content
IMPORTANT: Always use UTF-8 encoding on Windows.
Primary: Use scrape_web.py script (structured extraction)
python "/scripts/scrape_web.py" \
--url "" \
--output "/raw_article.md" \
--json
The --json flag outputs structured data including title, author, date, cover URL, and Markdown content.
Fallback: Use WebFetch tool (for JS-rendered pages)
If scrape_web.py fails (e.g., the page requires JavaScript rendering), use the built-in WebFetch tool:
WebFetch(url="", prompt="Extract the full article content including: title, author, publish date, and the complete article text. Return in a structured format.")
Then manually compose the Markdown from the WebFetch output.
After scraping: Read the output. Inspect the content structure and quality. Proceed to Phase 3.
Phase 3: AI Content Reformatting
This is the key quality step. The agent should:
- Read the scraped Markdown content
- Rewrite/reformat the content for WeChat publishing:
- Ensure clean heading hierarchy (H1 → H2 → H3)
- Fix broken formatting (tables, lists, code blocks)
- Remove navigation artifacts, ads, social media buttons
- Ensure paragraphs flow naturally
- Add section breaks where appropriate
- Keep the original meaning and facts intact
- Output a clean, well-structured Markdown file
Style options (ask user or auto-detect):
| Style | When to use |
|---|---|
| 忠实转载 (faithful reprint) | User wants exact copy, just clean formatting |
| 精华摘要 (key highlights) | Long article → condensed version with key points |
| 深度改写 (deep rewrite) | Rewrite in user's own voice/style |
Save the reformatted Markdown:
Write the reformatted content to /article.md using the Write tool.
Phase 4: Generate Cover Image
Use the ImageGen tool with a prompt derived from the article's topic and content.
- Save as
wechat_cover.pngin the workspace. - Size:
1024x768(WeChat cover ratio 4:3). - Make it visually compelling and relevant to the article topic.
Phase 5: Compress Cover Image
WeChat requires cover images (thumb_media_id) to be under 64KB.
python "/scripts/compress_image.py" \
--input "/wechat_cover.png" \
--output "/wechat_cover_compressed.jpg" \
--max-size 64
If the original cover is already under 64KB (rare for PNG), this step can be skipped. But always run it to be safe — it won't enlarge files.
Fallback: If compress_image.py fails to reach 64KB, use ImageGen to regenerate a simpler cover image (fewer details, simpler composition) and try again.
Phase 6: Convert to WeChat HTML
Use md_to_wechat_html.py from the file-to-wechat skill:
python "/scripts/md_to_wechat_html.py" \
--input "/article.md" \
--output "/wechat_article.html" \
--title ""
This generates WeChat-compatible inline-style HTML with Clockless design tokens.
Phase 7: Publish to WeChat Draft Box
On Windows, use Python subprocess to pass environment variables:
python -c "
import os, subprocess, sys
os.environ['WECHAT_APP_ID'] = ''
os.environ['WECHAT_APP_SECRET'] = ''
result = subprocess.run([
sys.executable,
r'/scripts/publish_to_wechat.py',
'--file', r'/wechat_article.html',
'--title', '',
'--cover', r'/wechat_cover_compressed.jpg',
'--digest', '',
'--source-url', ''
], capture_output=True, text=True, encoding='utf-8')
print(result.stdout)
print(result.stderr)
"
Or with environment variables already set:
python "/scripts/publish_to_wechat.py" \
--file "/wechat_article.html" \
--title "" \
--cover "/wechat_cover_compressed.jpg" \
--digest "" \
--source-url ""
Credentials: The script reads from WECHAT_APP_ID / WECHAT_APP_SECRET env vars. If not set, it prompts interactively.
Phase 8: Confirm & Handoff
Report success with Media ID and link to https://mp.weixin.qq.com/.
Tell the user: "文章已发送到你的微信公众号草稿箱,请登录微信公众平台审核后一键发布。"
Include:
- Original source URL
- Article title
- Content summary
- Media ID
Site Compatibility
| Site | Scraping Method | Notes |
|---|---|---|
| WeChat articles (mp.weixin.qq.com) | scrape_web.py | Anti-scraping: may need WebFetch fallback |
| Toutiao / 今日头条 | scrape_web.py | JS-heavy, may need WebFetch |
| Zhihu / 知乎 | scrape_web.py | Login wall for some content |
| CSDN | scrape_web.py | Works well |
| Juejin / 掘金 | scrape_web.py | Works well |
| Medium | scrape_web.py | Works well |
| News sites (generic) | scrape_web.py | Auto-detects article content |
| JS-rendered SPAs | WebFetch | Use browser rendering fallback |
Error Handling
| Error | Action |
|---|---|
| Page returns 403/404 | Try WebFetch; if blocked, inform user |
| Content too short (<200 chars) | Page may be JS-rendered, try WebFetch |
| Chinese characters garbled | scrape_web.py auto-detects encoding |
| Cover image > 64KB | Run compress_image.py; regenerate if needed |
| Images not loading in WeChat | publish_to_wechat.py auto-uploads to WeChat CDN |
| WeChat credentials missing | Script prompts interactively |
| IP not in whitelist | Show IP from error, guide user to mp.weixin.qq.com |
| WebFetch returns empty | Page has strong anti-scraping, inform user |
| Content copyrighted | Add disclaimer, keep source attribution |
Copyright & Attribution
IMPORTANT: When republishing web content:
- Always include the original source URL in the article metadata
- Preserve the original author's name when available
- Add a disclaimer line at the end: "本文内容来源于[原作者名称],原文发布于[来源网站]。如有侵权请联系删除。"
- Use
--source-urlwhen publishing to add a "Read More" link - Consider using "精华摘要" or "深度改写" style instead of exact copy to avoid copyright issues
Script Reference
| Script | Purpose |
|---|---|
scripts/scrape_web.py | Web scraping → clean Markdown (supports 10+ site types) |
scripts/compress_image.py | Image compression (target 64KB for WeChat cover) |
file-to-wechat/scripts/md_to_wechat_html.py | Markdown → WeChat inline HTML |
anything-to-wechat/scripts/publish_to_wechat.py | WeChat draft box publishing |
Configuration
| Variable | Required | Description |
|---|---|---|
WECHAT_APP_ID | Yes | WeChat Official Account AppID (or prompted interactively) |
WECHAT_APP_SECRET | Yes | WeChat Official Account AppSecret (or prompted interactively) |
Related skills
Save, search, and manage personal notes and knowledge bases in Get笔记 on explicit request.
Join a video meeting as an AI bot with voice, avatar, and screenshare across four operating modes.
Stores durable facts in a categorized, plain-markdown vault on disk, alongside your agent's built-in memory.
Find why your productivity system keeps failing, then apply the smallest fix — capacity math, bottleneck routing, durable local notes.
Fetch raw ad creative, app, ranking, and revenue data from AdMapix as structured JSON.
More from lutongsuo
Browse all skills将任意文件(PDF、Word、Excel、PPT、图片、音频、网页等)转换为 Markdown,再生成为精美的微信公众号文章并发布到草稿箱。组合 markitdown + md_to_wechat_html + publish_to_wechat 三阶段流水线。Use when the user wants to...
Take existing HTML content (file, URL, or pasted HTML) and publish it directly to WeChat Official Account draft box. No file conversion, no web scraping — ju...
沃尔夫冈·赖因哈德《征服世界:一部欧洲扩张的全球史,1415~2015》结构化知识库技能。包含24章深度摘要、12个核心分析框架、48个专业术语、15个分析模式及决策速查表。当用户讨论欧洲扩张史、殖民主义、帝国主义、去殖民化、全球史、大航海时代、东印度公司、奴隶贸易、殖民遗产等话题时激活。适用于学术研究辅助、历史...
One-step workflow: accept any file (PDF, DOCX, CSV, Markdown), folder, URL, or idea → generate polished HTML via html-anything → auto-convert for WeChat comp...
Generate high-quality videos from text or images with support for text-to-video, image animation, multi-image transitions, and keyframe animations via asynch...
升级版图像生成模型,支持高信息密度复杂场景文生图与图生图,具备风格转换、多图合成及灵活尺寸输出能力。