WX2MD
Use this skill to fetch a WeChat Official Account article and export it as a local Markdown note with metadata and images.
Tool
The bundled CLI lives in this skill folder:
cd wx2md
pip install -r requirements.txt
playwright install chromium
pip install -e .
wx2md "https://mp.weixin.qq.com/s/xxxx"
Direct script mode also works:
cd wx2md
python src/main.py "https://mp.weixin.qq.com/s/xxxx" --output ./output/articles
Workflow
- Validate the input is either a WeChat article URL or a text file containing URLs.
- Use Playwright Chromium to load the page because WeChat pages often need browser DOM execution.
- Extract metadata with WeChat selectors:
#activity-namefor title#js_namefor account/author#publish_timefor publish time#js_contentfor article body
- Normalize image URLs using
data-src, thensrc, thendata-backsrc. - Download images with
User-AgentandRefererheaders unless--no-imagesis set. - Replace image URLs with local relative paths.
- Convert the article body HTML to Markdown.
- Write
index.mdunderoutput/articles/<sanitized title>/.
Commands
wx2md "https://mp.weixin.qq.com/s/xxxx"
wx2md "https://mp.weixin.qq.com/s/xxxx" --output ./output/articles
wx2md "https://mp.weixin.qq.com/s/xxxx" --no-images
wx2md "https://mp.weixin.qq.com/s/xxxx" --format obsidian
wx2md "https://mp.weixin.qq.com/s/xxxx" --title "custom title"
wx2md urls.txt --output ./output/articles
Output
Default output:
output/
articles/
Article Title/
index.md
images/
001.jpg
002.png
Obsidian output uses attachments/ for images and adds simple front matter tags.
Verification
After export, check:
index.mdexists.- Front matter includes title, author, source, URL, created, and exported_at.
- Local image files exist unless
--no-imageswas used. - Markdown image links are relative and render from
index.md. - The body contains the article's major headings, paragraphs, quotes, and images.
Limits
This tool does not bypass login, CAPTCHA, region restrictions, deleted content, paywalls, or anti-abuse controls. If the browser cannot load the article or #js_content is empty, report a clear error and preserve the original link for manual handling.
Use only for personal learning, backup, and knowledge management. Preserve original source and URL.