WeChat Article Crawler with x402 Payment
微信公众号文章爬虫 - x402 支付版
支持实时支付(小额)和异步支付(大额)混合模式,使用 Base 链 USDC 支付。
When to Use
Use this skill when you need to:
- - Monitor competitor accounts: Track what other WeChat Official Accounts are publishing
- Content research: Gather articles from specific niches for analysis
- Archive building: Download complete post history from valuable accounts
- Keyword filtering: Find articles matching specific topics with weighted scoring
- Automated reporting: Schedule daily crawls of key accounts
- Price: Free tier (10 articles), then $0.1/article or $10/account via x402 on Base
Pricing
| 计费模式 | 价格 | 说明 |
|---|
| 按篇 | $0.1 USDC/篇 | 适合少量精准获取 |
| 按号 |
$10 USDC/号 | 批量获取某号全部历史文章 |
|
包月 | $100 USDC/月 | 30天无限使用 |
|
免费 | 10篇 | 新用户免费体验 |
Payment Modes
实时支付(<$5)
- - 小额支付,即时确认
- 支付后立即开始爬取
- 适合:按篇计费、少量文章
异步支付(≥$5)
- - 大额支付,后台处理
- 支付确认后加入队列
- 完成后通过 webhook 通知
- 适合:按号计费、批量爬取
Quick Start
1. Set User ID (Required)
CODEBLOCK0
2. Check Status
CODEBLOCK1
3. Crawl with Free Quota
CODEBLOCK2
4. Real-time Payment (small amount)
CODEBLOCK3
5. Async Payment (large amount)
CODEBLOCK4
6. Check Task Status
CODEBLOCK5
7. Subscribe Monthly
CODEBLOCK6
x402 Payment Flow
CODEBLOCK7
File Structure
CODEBLOCK8
Configuration
Edit config.py to customize:
CODEBLOCK9
Dependencies
CODEBLOCK10
Required: Python 3.8+, Google Chrome browser
Workflow Examples
Example 1: New User with Free Quota
CODEBLOCK11
Example 2: Real-time Payment
CODEBLOCK12
Example 3: Async Payment
CODEBLOCK13
Troubleshooting
Payment Issues
"Transaction not found"
- - Ensure you're on Base network (not Ethereum mainnet)
- Wait 30-60 seconds for transaction to be mined
- Check transaction on BaseScan
"Insufficient amount"
- - Verify you sent enough USDC (include decimals)
- Check transaction details for exact amount sent
"Payment expired"
- - Payment requests expire after 5 minutes
- Create a new crawl request
Crawl Issues
"WeChat login failed"
- - Close VPN before running
- Delete
weixin_credentials.py and retry - Use a different WeChat account (small accounts have lower ban risk)
"No articles found"
- - Verify the account name is correct (case-sensitive)
- Account may not have published recently
- Try searching for account first
"Account blocked"
- - WeChat detected automated access
- Wait 24 hours before retrying
- Reduce crawl frequency (built-in 5-15s delays help)
"Chrome not found"
- - Install Google Chrome: https://www.google.com/chrome/
- Or set CHROME_BIN environment variable to Chrome executable path
Installation Issues
"ModuleNotFoundError: No module named 'selenium'"
CODEBLOCK14
"ChromeDriver version mismatch"
CODEBLOCK15
Important Notes
- 1. WeChat Account Risk
- WeChat may ban accounts used for crawling
- Use a secondary/dedicated account
- Never use your primary WeChat account
- 2. VPN Must Be Disabled
- Close all VPN connections before crawling
- VPN causes WeChat login timeouts
- 3. Rate Limiting
- Built-in 5-15 second random delays between requests
- Don't run multiple crawls simultaneously
- Daily limit: 100-200 articles recommended
- 4. Base Chain Requirements
- Ensure wallet has Base network USDC
- Keep small amount of ETH for gas fees
- Verify receiving address before sending
On-Chain Verification
Enable on-chain verification for production:
CODEBLOCK16
Security Considerations
- - Receiving Address: Double-check
0x172444FC64e2E370fCcF297dB865831A1555b07A before sending payments - Private Keys: Never share wallet private keys; skill only needs public address
- Data Storage: User data stored locally in
data/ directory - WeChat Credentials: Saved in
weixin_credentials.py; keep this file secure
Data Storage Locations
The skill stores data in the following locations (relative to skill directory):
CODEBLOCK17
Tips
- - Free tier first: Always test with 10 free articles before paying
- Batch efficiently: Crawl full account history ($10) instead of many small payments
- Subscribe if regular: Monthly subscription pays for itself after 1000 articles
- Monitor task status: Async tasks can be checked anytime with INLINECODE5
- Use testnet first: Test on Base Sepolia with test USDC before mainnet
- Save credentials: After first login,
weixin_credentials.py allows 24hr re-access - Account safety: Rotate WeChat accounts monthly to reduce ban risk
- VPN reminder: Always disable VPN; check with
curl ipinfo.io if unsure - Payment receipts: Keep transaction hashes for dispute resolution
- Error logs: Check
data/queue/tasks.json for failed task details
License
MIT License - For educational and research purposes only
x402 Powered ⚡️ Programmatic payments via x402 protocol on Base
WeChat Article Crawler with x402 Payment
微信公众号文章爬虫 - x402 支付版
支持实时支付(小额)和异步支付(大额)混合模式,使用 Base 链 USDC 支付。
适用场景
在以下情况下使用此技能:
- - 监控竞品账号:追踪其他微信公众号的发布内容
- 内容研究:收集特定领域的文章进行分析
- 建立存档:下载有价值账号的完整历史文章
- 关键词筛选:通过加权评分查找匹配特定主题的文章
- 自动化报告:定时爬取关键账号的每日内容
- 价格:免费额度(10篇),之后按 $0.1/篇 或 $10/账号 通过 Base 链 x402 支付
定价方案
| 计费模式 | 价格 | 说明 |
|---|
| 按篇 | $0.1 USDC/篇 | 适合少量精准获取 |
| 按号 |
$10 USDC/号 | 批量获取某号全部历史文章 |
|
包月 | $100 USDC/月 | 30天无限使用 |
|
免费 | 10篇 | 新用户免费体验 |
支付模式
实时支付(<$5)
- - 小额支付,即时确认
- 支付后立即开始爬取
- 适合:按篇计费、少量文章
异步支付(≥$5)
- - 大额支付,后台处理
- 支付确认后加入队列
- 完成后通过 webhook 通知
- 适合:按号计费、批量爬取
快速开始
1. 设置用户ID(必需)
bash
export USER_ID=0xYourWalletAddress
2. 检查状态
bash
python3 spider
cli.py status --user $USERID
3. 使用免费额度爬取
bash
python3 spider
cli.py crawl --user $USERID --account 机器之心 --max 5 --mode free
4. 实时支付(小额)
bash
python3 spider
cli.py crawl --user $USERID --account 机器之心 --max 20
系统提示支付 $2 USDC
完成转账并输入交易哈希
5. 异步支付(大额)
bash
python3 spider
cli.py crawl --user $USERID --account 机器之心 --max 100 --mode async
支付 $10 USDC,任务进入后台处理队列
6. 检查任务状态
bash
python3 spider_cli.py status TASK-1711523456-7890
7. 订阅月度服务
bash
python3 spider
cli.py subscribe --user $USERID
支付 $100 USDC 获得30天无限使用权限
x402 支付流程
用户请求爬取 → 系统计算价格 →
├─ <$5 → 实时支付 → 用户转账 → 确认 → 立即爬取
└─ ≥$5 → 异步支付 → 用户转账 → 确认 → 加入队列 → 后台爬取 → 通知完成
文件结构
wechatarticlesspider/
├── SKILL.md # 本文档
├── config.py # 配置(定价、收款地址)
├── spider_cli.py # CLI入口
├── spider_api.py # API层
├── x402_core.py # x402支付核心
├── quota_manager.py # 用户配额管理
├── async_queue.py # 异步任务队列
├── blockchain_verifier.py # 链上验证
├── wechatmpcrawler.py # 核心爬虫逻辑
├── requirements.txt # Python依赖
└── data/ # 数据存储
├── users/ # 用户数据(配额、订阅)
└── queue/ # 异步任务队列
配置说明
编辑 config.py 进行自定义配置:
python
收款地址(已设置)
RECEIVING_ADDRESS = 0x172444FC64e2E370fCcF297dB865831A1555b07A
定价(USDC)
PRICING = {
per_article: 0.1,
per_account: 10.0,
monthly: 100.0,
}
异步阈值
ASYNC_THRESHOLD = 5.0 # 支付金额 >= $5 时使用异步模式
依赖安装
bash
pip install -r requirements.txt
所需环境:Python 3.8+,Google Chrome 浏览器
工作流程示例
示例1:新用户使用免费额度
$ python3 spider_cli.py crawl --user 0xNewUser --account 机器之心 --max 5 --mode free
🎁 免费额度:10/10 篇
📅 月度订阅:❌ 未激活
🚀 使用免费额度爬取5篇文章...
✅ 成功!
文章数:5
费用:$0 USDC
支付方式:免费
剩余免费额度:5
示例2:实时支付
$ python3 spider_cli.py crawl --user 0xUser --account 机器之心 --max 20
🎁 免费额度:0/10 篇
📅 月度订阅:❌ 未激活
💳 需要支付:$2.0 USDC
收款地址:0x172444FC64e2E370fCcF297dB865831A1555b07A
网络:Base
步骤:
- 1. 打开钱包(MetaMask / Coinbase Wallet)
- 切换到 Base 网络
- 发送 $2.0 USDC 至:0x172444FC64e2E370fCcF297dB865831A1555b07A
- 复制交易哈希
请输入交易哈希(0x...):0xabc123...
✅ 成功!
文章数:20
费用:$2.0 USDC
支付方式:x402
交易哈希:0xabc123...
示例3:异步支付
$ python3 spider_cli.py crawl --user 0xUser --account 机器之心 --max 200 --mode async
💳 需要支付:$10.0 USDC
...
请输入交易哈希(0x...):0xdef456...
✅ 支付确认,任务已加入队列
任务ID:TASK-1711523456-7890
使用以下命令检查状态:status TASK-1711523456-7890
$ python3 spider_cli.py status TASK-1711523456-7890
📋 任务状态:TASK-1711523456-7890
账号:机器之心
状态:处理中
...
10分钟后
📋 任务状态:TASK-1711523456-7890
状态:已完成
结果:{articles_count: 200}
故障排除
支付问题
未找到交易
- - 确保你在 Base 网络(而非以太坊主网)
- 等待30-60秒让交易被确认
- 在 BaseScan 上检查交易
金额不足
- - 确认发送了足够的 USDC(注意小数位)
- 检查交易详情中的实际发送金额
支付已过期
爬取问题
微信登录失败
- - 运行前关闭VPN
- 删除 weixin_credentials.py 后重试
- 使用不同的微信账号(小号被封风险较低)
未找到文章
- - 确认账号名称正确(区分大小写)
- 该账号可能近期未发布内容
- 尝试先搜索该账号
账号被封
- - 微信检测到自动化访问
- 等待24小时后重试
- 降低爬取频率(内置5-15秒延迟有助于规避)
未找到Chrome
- - 安装 Google Chrome:https://www.google.com/chrome/
- 或设置 CHROME_BIN 环境变量指向 Chrome 可执行文件路径
安装问题
ModuleNotFoundError: No module named selenium
bash
pip install -r requirements.txt
ChromeDriver 版本不匹配
bash
webdriver-manager 应自动下载,如遇问题:
pip install --upgrade webdriver-manager
重要提示
- 1. 微信账号风险
- 微信可能封禁用于爬取的账号
- 使用备用/专用账号
- 切勿使用主微信账号
- 2. 必须关闭VPN
- 爬取前关闭所有VPN连接
- VPN会导致微信登录超时
- 3. 频率