# Cron Job: 春考选题-文章抓取

**Job ID:** 94d230f73e7f
**Run Time:** 2026-06-24 08:42:23
**Schedule:** every 120m

## Prompt

[IMPORTANT: You are running as a scheduled cron job. DELIVERY: Your final response will be automatically delivered to the user — do NOT use send_message or try to deliver the output yourself. Just produce your report/output as your final response and the system handles the rest. SILENT: If there is genuinely nothing new to report, respond with exactly "[SILENT]" (nothing else) to suppress delivery. Never combine [SILENT] with content — either report your findings normally, or say [SILENT] and nothing more.]

在服务器上抓取微信公众号最新文章，然后推送到企微群。

步骤：
1. cd /home/agentuser/project/scripts
2. 设置环境变量：export DEEPSEEK_API_KEY=$(grep DEEPSEEK_API_KEY ../.env | cut -d= -f2) && export QW_WEBHOOK_URL=$(grep QW_WEBHOOK_URL ../.env | cut -d= -f2-) && export WE_MP_RSS_AK=$(grep WE_MP_RSS_AK ../.env | cut -d= -f2) && export WE_MP_RSS_SK=$(grep WE_MP_RSS_SK ../.env | cut -d= -f2)
3. 运行 python3 -c "
import os, sys
sys.path.insert(0, '.')
from utils import send_qw_markdown
from fetch_articles import main as fetch_main

# Step 1: Fetch
fetch_main()

# Step 2: Check pending articles
from utils import load_pending
pending = load_pending()
articles = pending.get('articles', [])
new_articles = [a for a in articles if not a.get('processed')]

if not new_articles:
    print('No new articles to push')
else:
    # Push each new article
    count = 0
    for art in new_articles[:5]:  # max 5 per run
        title = art.get('title', '无标题')
        url = art.get('url', '')
        source = art.get('source', '未知来源')
        summary = art.get('summary', '')[:200]
        content = f'## 📰 {title}\n> 来源：{source}\n\n{summary}\n\n[阅读原文]({url})'
        if send_qw_markdown(content):
            art['processed'] = True
            count += 1
            print(f'Pushed: {title[:40]}')
    
    from utils import save_pending
    save_pending(pending)
    print(f'Total pushed: {count}/{len(new_articles)}')
" 2>&1

不用问我任何问题，直接执行。

## Response

## 执行结果报告

### 任务：抓取微信公众号文章 → 推送到企微群

**执行状态：未完成（配置缺失 + 网络不通）**

---

### 诊断结果

| 检查项 | 状态 | 详情 |
|--------|------|------|
| 脚本文件 | ✅ 存在 | `fetch_articles.py`, `utils.py` 就绪 |
| `.env` 凭证 | ❌ 占位符 | `WE_MP_RSS_AK=PLACEHOLDER_AK`、`WE_MP_RSS_SK=PLACEHOLDER_SK`、`QW_WEBHOOK_URL=PLACEHOLDER_WEBHOOK_URL` |
| WeMP API 连通性 | ❌ SSL 握手失败 | DNS 解析正常 (`64.190.63.222`)，ping 可达 (244ms)，但 TLS 握手时 `SSL_ERROR_SYSCALL` |
| `pending.json` | ❌ 不存在 | 无历史待推送文章可回退 |

---

### 具体错误

**WeMP API 调用：**
```
HTTPSConnectionPool(host='api.wemp.com', port=443): Max retries exceeded
SSLEOFError: EOF occurred in violation of protocol (_ssl.c:1016)
```

**curl 验证：**
```
OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to api.wemp.com:443
curl: (35) OpenSSL SSL_connect: SSL_ERROR_SYSCALL
```

---

### 需要修复的事项

1. **替换 `.env` 中的占位符为真实凭证**：`WE_MP_RSS_AK`、`WE_MP_RSS_SK`、`QW_WEBHOOK_URL` 都需要填入真实值。
2. **排查网络/TLS 问题**：服务器到 `api.wemp.com (64.190.63.222):443` 的 TLS 握手被中断，可能是防火墙或 GFW 阻断，需检查是否需要配置代理。

两件事任一未解决，此任务都无法产出实际推送。
