docs: 更新 continuation.md 2026-07-23 会话记录

- investing.com 反爬策略调整(Google News RSS + magic/stealth)
- forexlive→investinglive 迁移
- 各源抓取状态表更新

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-07-23 09:26:53 +08:00
co-authored by Claude
parent 5c106120bf
commit f0adf713b7
+66 -101
View File
@@ -1,14 +1,48 @@
# continuation.md — English Financial News 项目状态
> 最后更新:2026-07-17
> 最后更新:2026-07-23
---
## 2026-07-17 修复
## 2026-07-23 会话成果
### domestic_crawl_8g.sh 无参崩溃
- `"$1"` 触发 `set -u``"${1:-}"`
- 已同步 Pi,语法检查通过
### investing.com 反爬策略调整
**问题:** RSS 返回 403Cloudflare),Web headful 间歇性失败(数据中心 IP 被标记)
**改动:**
| 文件 | 改动内容 |
|------|---------|
| `crawler/crawler.py` | `magic=True` + `enable_stealth=True` Crawl4AI/Playwright 全自动反检测;`--disable-webrtc` 防止 IP 泄露;`delay_before_return_html=3s` 等待 Cloudflare 挑战;`remove_consent_popups=True` 自动关弹窗;`wait_until="domcontentloaded"` 避免被 Cloudflare 阻塞;增加列表页 URL 过滤(`most-popular-news`/`trending` 等) |
| `crawler/rss_crawler.py` | 新增 `_make_rss_client()` 读取 system.yaml 代理配置创建 httpx 客户端;Google News RSS 跳过 `article_url_pattern` 域名过滤 |
| `configs/sources.yaml` | investing.com`rss_url` 切换为 Google News RSS 代理(绕过 Cloudflare),增加 `anti_bot_mode: stealth`forexlive → investinglive 迁移 |
| `scripts/domestic_crawl_8g.sh` | `HTTP_PROXY`/`HTTPS_PROXY` 移至 `.env` 加载之前,确保 httpx 继承代理 |
**测试结果(investing.com):**
| 策略 | 结果 |
|------|------|
| Google News RSS(代理) | ✅ 25/25 篇,423 words/篇平均 |
| Web headful 首页 | ✅ 可加载,提取 ~25 个文章链接(15s) |
| Web headful 文章页 | ❌ 所有文章页仍被 Cloudflare 拦截(403 |
### forexlive → investinglive 迁移
**问题:** `forexlive.com` 域名 301 重定向到 `investinglive.com``_is_valid_article_url` 域名过滤拒绝所有链接
**改动:** `sources.yaml` — 移除 `forexlive` 源,新增 `investinglive`
| 字段 | 旧值 | 新值 |
|------|------|------|
| id | `forexlive` | `investinglive` |
| name | ForexLive | InvestingLive |
| homepage | `forexlive.com/` | `investinglive.com/` |
| rss_url | `forexlive.com/feed` | `investinglive.com/feed` |
| article_url_pattern | `/(news\|technical-analysis\|Education)/` | `/(news\|central-banks\|commodities\|stocks\|technical-analysis)/` |
| max_articles | 20 | 25 |
**测试结果:**`found=25 success=25`100%,全文 3-9KB/篇(RSS 内嵌完整正文)
---
@@ -16,7 +50,7 @@
```
M0 ✅ 项目骨架
M1 ✅ 新闻抓取(12/12 源,Pi headful Playwright + HTTP 代理)
M1 ✅ 新闻抓取(13/13 源,Pi headful Playwright + HTTP 代理)
M2 ✅ 正文提取(trafilatura + MD 回退,增量跳过已处理)
M3 ✅ 三层去重(L1 URL / L2 Content / L3 SimHashSQLite 指纹库)
M4 ✅ 翻译+事件抽取(DeepSeek v4-flash,事件去重 Prompt 约束)
@@ -28,61 +62,33 @@ M8 ✅ MCP 服务(FastMCP 5 个 Tool
---
## 架构变更(2026-07-14
## 各源抓取状态
### 之前
```
海外 M1 (crawl) → pack → rsync → Pi M2→M6 → 日报
```
### 现在
```
Pi M1 (headful+proxy) → Pi M2→M6 → 日报
(海外服务器不再参与流水线)
```
### 修改文件
| 文件 | 改动 |
|------|------|
| `configs/profiles/8g_headful.yaml` | proxy URL: `socks5://1080``http://127.0.0.1:3128` |
| `configs/system.yaml` | 调度时间 `06:00/12:00/18:00/22:00`,同步段标为参考 |
| `scripts/domestic_full.sh` | 重写:移除海外 SSH 触发/sync,2 步:M1 抓取 → 管道+日报 |
| `scripts/domestic_crawl_8g.sh` | 注释更新 |
| `scheduler/jobs.py` | 移除海外 crontab,国内统一 domestic_full.sh 每日 4 次 |
### 抓取能力测试结果
| 源 | 结果 | 说明 |
|----|------|------|
| Forexlive | ✅ 13/13 Web 100% | headful 绕过 RSS 限制,获取正文 |
| MarketWatch | ✅ 3 篇 Web 新增 | DataDome 部分破解 |
| SeekingAlpha | ✅ RSS 稳定 | 30 篇增量跳过,无需 Web |
| WSJ | ✅ RSS 稳定 | Dow Jones RSS 兜底 |
| Barron's | ✅ RSS 稳定 | Dow Jones RSS 兜底 |
| CNBC/Yahoo/ZeroHedge/Economist | ✅ RSS 稳定 | 增量跳过 |
| **Reuters** | ❌ DataDome captcha | headful+proxy+stealth 均无法绕过 |
| **FT** | ❌ 超时 | RSS 超时,首页无可用链接 |
| **Investing.com** | ❌ Cloudflare 拦截 | RSS 403Web 被 Cloudflare JS 挑战拦截 |
| 源 | 策略 | 状态 | 说明 |
|----|------|------|------|
| Reuters | Google News RSS | ⚠️ 摘要,RSS 稳定 | DataDome 反爬无法突破 |
| CNBC | CNBC RSS | ✅ 稳定 | 原生 RSS 正常 |
| MarketWatch | RSS + stealth | ✅ 稳定 | RSS 优先,stealth 回退 |
| FT | FT RSS | ⚠️ 摘要,RSS 稳定 | 付费墙,全文不可用 |
| Yahoo Finance | Yahoo RSS | ✅ 稳定 | RSS 正常 |
| **Investing.com** | **Google News RSS** + stealth | **✅ RSS 25/篇,Web ❌** | **2026-07-23 修复:RSS 改用 Google News 代理** |
| Seeking Alpha | RSS + stealth | ✅ 稳定 | RSS 稳定 |
| Barron's | Dow Jones RSS + stealth | ✅ 稳定 | 无原生 RSSDow Jones 兜底 |
| WSJ | Dow Jones RSS + stealth | ✅ 稳定 | RSS 正常 |
| Economist | RSS + stealth | ✅ 稳定 | RSS 正常 |
| **InvestingLive** | **RSS** | **✅ 25/篇 100%** | **2026-07-23 新增(forexlive 迁移)** |
| ZeroHedge | FeedBurner RSS | ✅ 稳定 | RSS 含全文 |
| ~~Forexlive~~ | ~~RSS 已失效~~ | ~~❌ 301→investinglive~~ | **已替换为 InvestingLive** |
---
## 2026-07-14 会话成果
## 待办事项
### Pi Shadowsocks 客户端部署
- `shadowsocks-libev` + `v2ray-plugin v1.3.2`arm64)已安装
- `ss-local` 配置 `0.0.0.0:1088`SOCKS5),systemd 已启用
- `privoxy` 配置 `0.0.0.0:3128`HTTP → SOCKS5),已运行
- 配置文件 `/etc/shadowsocks-libev/config.json` 已创建(服务端信息待用户填入)
### 全链路独立化
- 海外服务器不再承担 M1 抓取任务
- Pi 通过 `8g_headful` profile`EN_NEWS_PROFILE`)执行 headful Playwright + HTTP 代理抓取
- `domestic_full.sh` 简化为 2 步:M1 抓取 → 管道(含日报)
1. **Investing.com 全文抓取** — Google News RSS 仅摘要,Web headful 仍被 Cloudflare 拦截(需要更好代理线路或住宅 IP)
2. **Reuters 全文** — 同上,DataDome 需要更先进的代理
3. **FT 付费墙** — 需要付费订阅或放弃全文
4. **海外服务器 crontab 停用** — 确认不再参与流水线后清理
5. **Pi crontab 确认** — 当前 `logs/full.log` 显示调度正常运行(06/12/18/22 四个时间点)
---
@@ -90,57 +96,16 @@ Pi M1 (headful+proxy) → Pi M2→M6 → 日报
| 角色 | 地址 | 路径 | 状态 |
|------|------|------|------|
| 海外 | `ecs-user@8.217.19.253` | `/opt/intlgrab` | ⏸️ 不再参与流水线crontab 待停用 |
| 海外 | `ecs-user@8.217.19.253` | `/opt/intlgrab` | ⏸️ 不再参与流水线 |
| 国内 | `pi@192.168.1.160` | `/home/pi/intlnews` | ✅ 全链路独立运行 |
---
## 定时任务(待设置)
### Pi crontab(需用户手动执行 `crontab -e`
```
# 全流程:M1 抓取 → M2→M6 管道 → 日报
0 6 * * * cd /home/pi/intlnews && bash scripts/domestic_full.sh >> logs/full.log 2>&1
0 12 * * * cd /home/pi/intlnews && bash scripts/domestic_full.sh >> logs/full.log 2>&1
0 18 * * * cd /home/pi/intlnews && bash scripts/domestic_full.sh >> logs/full.log 2>&1
0 22 * * * cd /home/pi/intlnews && bash scripts/domestic_full.sh >> logs/full.log 2>&1
# Xvfb 开机自启
@reboot Xvfb :99 -screen 0 1280x1024x24 -ac +extension RANDR &
```
### 海外服务器 crontab(待停用)
```
# 当前仍在运行,需停用
# 0 6 * * * overseas_crawl.sh
# 0 11 * * * overseas_crawl.sh
# 0 17 * * * overseas_crawl.sh
# 0 23 * * * overseas_crawl.sh
```
---
## 待办事项
1. **用户填入 Shadowsocks 服务端信息** → 启动 ss-local
2. **Pi crontab 设置** → 全流程定时 + Xvfb 开机自启
3. **海外 crontab 停用**`crontab -e` 注释掉抓取调度
4. **Reuters / FT / Investing.com** → 反爬问题未解决,需后续策略
5. **日报新闻源单一问题** → 前次分析已定位根因(域名映射、RSS 摘要质量),未修复
---
## CLI 命令速查
```
uv run en-news crawl M1 全量(默认 profile
uv run en-news crawl --profile 8g_headful M1 headful + proxy
uv run en-news pipeline M2→M6 全链路
uv run en-news report M7 日报
uv run en-news search "query" M6 搜索
uv run en-news mcp-server M8 MCP
bash scripts/domestic_full.sh 全流程(M1→M6→日报)
bash scripts/domestic_crawl_8g.sh 仅 M1 headful
bash scripts/domestic_crawl_8g.sh 仅 M1 headful(可跟源 ID
bash scripts/domestic_crawl_8g.sh investing 单源测试
PYTHONPATH=. .venv/bin/python3 -c "..." 直接调用 orchestrator
```