Skill Overview
Project Path: ~/wechat_ai_radar/
WeChat Moments AI Radar is a complete automated content collection + analysis system. Core workflow:
微信朋友圈滚动截图 → AI视觉提取内容 → 存储数据库 → AI分类聚合分析 → 生成结构化简报
Core Architecture
Module Description
| Module | Path | Function |
|---|---|---|
| config.py | ~/wechat_ai_radar/config.py |
Global configuration (coordinates, API, logs, etc.) |
| app.py | ~/wechat_ai_radar/app.py |
Main program entry point, supports multiple run modes |
| run_300.py | ~/wechat_ai_radar/run_300.py |
Complete workflow script for collecting 300 posts |
| automation/ | automation/scroll_moments.py |
PyAutoGUI simulated scrolling screenshots |
| extractor/ | extractor/moments_extractor.py |
AI vision extracts Moments content from screenshots |
| db/ | db/database.py |
SQLite database read/write |
| ai/ | ai/classify.py, ai/summarize.py |
AI classification and aggregation analysis |
| reports/ | reports/daily_report.py |
Daily report generator |
Key Configuration Parameters
Moments window coordinates (calibrated)
WECHAT_MOMENTS_FALLBACK_X = 0 # 朋友圈窗口x坐标(屏幕左上角)
WECHAT_MOMENTS_FALLBACK_Y = 0 # 朋友圈窗口y坐标
WECHAT_CONTENT_WIDTH = 550 # 内容区宽度
WECHAT_CONTENT_HEIGHT = 969 # 内容区高度
滚动鼠标目标 = (275, 484) # 内容区中心
Scrolling parameters
SCROLL_COUNT = 50 # 默认滚动次数
SCROLL_INTERVAL = 1.0 # 滚动间隔(秒)
SCROLL_AMOUNT = -300 # 每次滚动像素量(负值=向上)
SCROLL_MOUSE_CLICKS = 3 # 每次滚动执行几次scroll调用
AI API configuration
AI_API_URL = "https://api.qingyuntop.top/v1" # 青禾聚合API
AI_API_KEY = config.AI_API_KEY # 从config读取
AI_MODEL = "gpt-4o-mini"
AI_MAX_TOKENS = 4000
AI_TEMPERATURE = 0.7
AI_REQUEST_DELAY = 1.0 # API请求间隔(秒)
AI_BATCH_SIZE = 10 # 每批处理数量
Usage
Method 1: Complete collection workflow (collection + analysis + briefing)
cd ~/wechat_ai_radar && uv run python run_300.py
Workflow:
- Automatically open/activate WeChat
- Execute 150 scrolling screenshots (about 300 posts)
- AI vision extracts content → store in
moments.db - AI aggregation analysis
- Generate briefing (Markdown format)
Target: about 300 posts / takes about 15-20 minutes
Method 2: Collect screenshots only (no analysis)
cd ~/wechat_ai_radar && uv run python -c "
from automation.open_wechat import WeChatOpener
from automation.scroll_moments import MomentsScroller
import config
opener = WeChatOpener()
opener.activate_wechat()
scroller = MomentsScroller(scroll_count=50, scroll_interval=1.5)
screenshots = scroller.scroll_full(capture=True)
print(f'截图完成: {len(screenshots)} 张')
"
Method 3: Generate briefing based on existing data
When there is already a extracted_*.json data file, directly generate the briefing:
cd ~/wechat_ai_radar && uv run python reports/generate_daily_report.py
Daily report structure(user-specified framework):
# 今日朋友圈热点
## 🔥 热门关键词
## 📈 热门分类(AI/活动/创业/SaaS/出海/促销)
## 💼 商机发现(AI合作/合作需求/创业动态/投资动态)
## 👥 高频人物
## 🧠 AI总结
Method 4: app.py multi-mode operation
# 仅滚动截图
uv run python app.py scroll
# OCR文字提取(需要paddleocr)
uv run python app.py ocr
# AI分析已有数据
uv run python app.py analyze
# AI总结
uv run python app.py summarize
# 生成日报
uv run python app.py report
# 启动定时任务(每天21:00自动运行)
uv run python app.py schedule --hour 21 --minute 0
Data file paths
| Purpose | Path |
|---|---|
| Database | ~/wechat_ai_radar/data/moments.db |
| Screenshot directory | ~/wechat_ai_radar/screenshots/ |
| Report directory | ~/wechat_ai_radar/reports/ |
| Log directory | ~/wechat_ai_radar/logs/ |
| Latest extracted data | ~/wechat_ai_radar/data/extracted_YYYYMMDD_HHMMSS.json |
Database Structure
-- moments 表
id, content, author, image_path, created_at, hash,
likes, comments, is_analyzed, category, keywords,
people, companies, business_opportunity, sentiment, summary
# 读取数据示例
from db.database import Database
from db.storage import Storage
db = Database()
storage = Storage(db)
moments = storage.get_recent(days=7, limit=100)
for m in moments:
print(f"[{m.author}] {m.content[:50]}")
Packaged Convenience Scripts
1. reports/generate_daily_report.py
- Input:
extracted_*.jsonfile - Output: Markdown format daily report + Word document
- Framework: trending keywords/categories/business opportunities/figures/AI summary
2. reports/daily_report_to_docx.py
- Convert daily report data to Word document (A4 landscape, blue theme)
3. extract_and_analyze.py
- Batch process screenshots → AI extraction → store in database
Prerequisites
# 安装依赖
cd ~/wechat_ai_radar && uv sync
# 核心依赖(pyproject.toml)
pyautogui, Pillow, python-dateutil, openai, httpx, APScheduler
Known Limitations
- Window must be visible: the Moments window must be visible on the screen (cannot be minimized)
- Coordinates depend on screen layout: calibrated to (x=0, y=0) top-left screen layout
- Mac-exclusive: uses PyAutoGUI + macOS-specific configuration
- OCR optional: when paddleocr is not installed, skip OCR and use AI vision extraction instead
Quick Command Summary
# 完整采集+简报
cd ~/wechat_ai_radar && uv run python run_300.py
# 快速生成日报(基于已有JSON)
cd ~/wechat_ai_radar && uv run python reports/generate_daily_report.py
# 生成Word版日报
cd ~/wechat_ai_radar && uv run python reports/daily_report_to_docx.py
# 采集50次滚动截图
cd ~/wechat_ai_radar && uv run python -c "
from automation.open_wechat import WeChatOpener
from automation.scroll_moments import MomentsScroller
opener = WeChatOpener()
opener.activate_wechat()
scroller = MomentsScroller(scroll_count=50, scroll_interval=1.5)
screenshots = scroller.scroll_full(capture=True)
print(f'完成: {len(screenshots)} 张截图')
"