BW

bzd6661/wechat-article-for-ai

Developer tools

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る

104 stars 14 forks 品質 59 トレンド 0

bzd6661/wechat-article-for-ai は、https://github.com/bzd6661/wechat-article-for-ai. からインポートされたMCPサーバー候補です。

概要

bzd6661/wechat-article-for-ai は、https://github.com/bzd6661/wechat-article-for-ai. からインポートされたMCPサーバー候補です。

概要(AI 翻訳)

英語 |中文


英語

微信公众号(WeChat Official Account)の記事をローカルにダウンロードした画像付きのクリーンなMarkdownファイルに変換するモジュラーPythonツールです。人間利用(CLI)とAIエージェント統合(MCPサーバー+SKILL.md)の両方に対応して設計されています。

特徴

  • アンチ検出スクレイピング — Camoufox(ステルスFirefox)を使ってWeChatのボット検知を回避
  • スマートページ読み込み — networkidle ハードコードのスリープの代わりに待機
  • Retry logic — ページ取得×指数バックオフ、画像ダウンロード 3×線形バックオフ
  • CAPTCHA検出 — 実行可能なエラーメッセージを伴う明示的検出
  • バッチ処理 — ARGやファイル入力による複数のURLを
  • 画像ローカライゼーション — ContentTypeベースの拡張推論による並行非同期ダウンロード
  • コードブロック保存 — 言語検出、CSSカウンターのガベージフィルタリング
  • メディア抽出 — WeChatの 音声および の映像要素を扱う
  • YAML フロントマター — 構造化メタデータ(タイトル、著者、日付、ソース)
  • MCPサーバー — 任意のMCP互換AIクライアントのツールとして公開
  • SKILL.md — Claude Codeスキル統合の準備完了

就任

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。

README

以下は原文 README の抜粋です。原文を見る。

wechat-article-for-ai

English | 中文


English

A modular Python tool that converts WeChat Official Account (微信公众号) articles into clean Markdown files with locally downloaded images. Designed for both human use (CLI) and AI agent integration (MCP server + SKILL.md).

Features

  • Anti-detection scraping — Uses Camoufox (stealth Firefox) to bypass WeChat’s bot detection
  • Smart page loading — networkidle wait instead of hardcoded sleep
  • Retry logic — 3× exponential backoff for page fetching, 3× linear backoff for image downloads
  • CAPTCHA detection — Explicit detection with actionable error messages
  • Batch processing — Multiple URLs via args or file input
  • Image localization — Concurrent async downloads with Content-Type based extension inference
  • Code block preservation — Language detection, CSS counter garbage filtering
  • Media extraction — Handles WeChat’s audio and video elements
  • YAML frontmatter — Structured metadata (title, author, date, source)
  • MCP server — Expose as tools for any MCP-compatible AI client
  • SKILL.md — Ready for Claude Code skill integration

Installation

git clone https://github.com/bzd6661/wechat-article-for-ai.git
cd wechat-article-for-ai
pip install -r requirements.txt

Camoufox browser will be auto-downloaded on first run.

Usage

CLI — Single Article

python main.py "https://mp.weixin.qq.com/s/ARTICLE_ID"

CLI — Batch from File

python main.py -f urls.txt -o ./output -v

CLI Options

Flag Description
urls One or more WeChat article URLs
-f, --file FILE Text file with URLs (one per line, # for comments)
-o, --output DIR Output directory (default: ./output)
-c, --concurrency N Max concurrent image downloads (default: 5)
--no-images Skip image download, keep remote URLs
--no-headless Show browser window (for solving CAPTCHAs)
--force Overwrite existing output
--no-frontmatter Use blockquote metadata instead of YAML frontmatter
-v, --verbose Enable debug logging

MCP Server

Run as an MCP server for AI tool integration:

python mcp_server.py

Tools exposed:

  • convert_article — Convert a single WeChat article to Markdown
  • batch_convert — Convert multiple articles in one call

MCP client configuration (e.g. claude_desktop_config.json):

{
  "mcpServers": {
    "wechat-to-md": {
      "command": "python",
      "args": ["mcp_server.py"],
      "cwd": "/path/to/wechat-article-for-ai"
    }
  }
}

Output Structure

output/
  /
    .md
    images/
      img_001.png
      img_002.jpg
      ...

Project Structure

wechat_to_md/
  __init__.py        # Package init, public API
GitHub で README 全文を見る

インストール

This server does not publish a one-line install command.

Open the repository installation guide MCP 初心者?mcpskill.org のガイドから始めましょう →

設定

{ "mcpServers": { "wechat-to-md": { "command": "python", "args": ["mcp_server.py"], "cwd": "/path/to/wechat-article-for-ai" } } }