Skip to main content

WeChat CLI Export

Export WeChat group member lists to CSV/JSON using wechat-cli, with automatic fixes for Windows GBK encoding issues (emoji crashes).

Prerequisites

  • wechat-cli must be installed and initialized (wechat-cli init)
  • Python 3.10+

Usage

Quick Export (Single Group)

Example:
Outputs:
  • ~/群成员_26常工院NEC-RC主赛.csv — 三字段表格
  • ~/members_26常工院NEC-RC主赛.json — 完整原始数据

Options

Direct wechat-cli Usage

If the bundled script is insufficient, call wechat-cli directly with encoding fixes:
Always set PYTHONIOENCODING=utf-8 before running wechat-cli on Windows to prevent emoji-related GBK crashes.

Output Fields (CSV)

Windows Encoding Fix

The bundled script automatically:
  1. Sets PYTHONIOENCODING=utf-8 for the subprocess
  2. Falls back to GBK decoding if UTF-8 fails
  3. Outputs CSV with UTF-8-BOM for Excel compatibility
If running wechat-cli manually on Windows and seeing UnicodeEncodeError: 'gbk' codec can't encode character, apply the fix in wechat_cli/output/formatter.py: