A self-contained workflow skill: input a WeChat article link, output an organized Markdown article directory.
Use Cases
- The user provided an mp.weixin.qq.com article link
- Need to directly produce Markdown without manually chaining multiple skills
- Need to copy the skill to another project or share it with others
Usage
python scripts/wechat_article_pipeline.py <wechat_article_url> [--output-dir <目录>] [--save-html]
Example
python scripts/wechat_article_pipeline.py "https://mp.weixin.qq.com/s/xxxxxx" --output-dir "./articles"
If you also need to keep the cleaned HTML after scraping:
python scripts/wechat_article_pipeline.py "https://mp.weixin.qq.com/s/xxxxxx" --output-dir "./articles" --save-html
Workflow
Execute by completing the following steps:
- Request the WeChat article page
- Extract the title, author, official account name, and body area
- Fix WeChat article lazy-loaded image URLs
- Download body images to the local output directory
- Convert the body to Markdown
- First run the script's built-in Markdown formatter to clean up headings, blank lines, invalid links, missing images, and official account noise content
- If the markdown-formatter skill exists in the current environment, automatically run markdown-formatter rule cleanup once more on the generated Markdown
- Output the article directory, Markdown path, and processing summary
Output Structure
articles/
├── 01_文章标题/
│ ├── 文章标题.md
│ ├── source.html
│ ├── image_01.jpg
│ ├── image_02.png
│ └── ...
Notes:
- Directories automatically increment by number, for example 01_, 02_, 03_
- The Markdown file name stays consistent with the directory title
- source.html is only output additionally when using --save-html
Parameters
<wechat_article_url>: WeChat article link--output-dir: Output directory, default:{工作区}/articles--workspace-dir: Workspace directory, automatically detected by default--save-html: Whether to save the cleaned HTML file--timeout: Request timeout in seconds, default 30
Workspace Detection
The script detects the workspace directory in the following priority order:
--workspace-dirparameter- Environment variable
WORKSPACE_DIR - Environment variable
PROJECT_ROOT - Environment variable
CLAUDE_WORKSPACE - Current working directory
Articles are output by default to the {工作区}/articles/ directory.
Dependencies
- Python 3.9+
- requests
Install dependencies:
pip install requests
Output Summary
After the script completes, it outputs:
- Article title
- Author and official account information
- Output directory
- Markdown file path
- Number of downloaded images
- Formatting change summary
Notes
- This skill is an independent implementation and does not depend on other skills
- If the markdown-formatter skill exists in the current project, when using this skill you should automatically run markdown-formatter once more after the script generates Markdown
- Mainly oriented toward WeChat public article page structures; ordinary web pages are not guaranteed to be fully compatible
- If the article is restricted, deleted, or requires login, scraping will fail
- Markdown will be written directly to the target file in the output directory