diff --git a/intlnews_usage.html b/intlnews_usage.html new file mode 100644 index 0000000..5720f14 --- /dev/null +++ b/intlnews_usage.html @@ -0,0 +1,390 @@ + + + + + +IntlNews 操作手册 + + + +
+ +

📰 IntlNews — 国际财经新闻 Deep Research

+

最后更新:2026-07-23 | 运行服务器:pi@192.168.1.160

+ +
+项目定位:面向国际财经新闻的私有化 Deep Research 平台。抓取英文财经新闻 → 英译中 → 事件抽取 → 向量入库 → MCP Agent 深度研究。 +
+ + +

一、系统架构

+Arch + +
+┌──────────────────────────────────────────────────────┐
+│                   Pi 4 (8GB)                          │
+│  ┌──────────┐   ┌──────────┐   ┌──────────────────┐  │
+│  │ M1 抓取   │──▶│ M2 正文  │──▶│ M3 三层去重      │  │
+│  │ headful   │   │ trafilat.│   │ URL/Content/SimH │  │
+│  │ Playwright│   │          │   │                  │  │
+│  │ + HTTP 代 │   │          │   │                  │  │
+│  │ 理(海外)  │   │          │   │                  │  │
+│  └──────────┘   └──────────┘   └────────┬─────────┘  │
+│                                         ▼            │
+│  ┌──────────┐   ┌──────────┐   ┌──────────────────┐  │
+│  │ M6 Qdrant│◀──│ M5 向量  │◀──│ M4 翻译+事件抽取  │  │
+│  │ 入库     │   │ DashScope│   │ DeepSeek v4      │  │
+│  └────┬─────┘   └──────────┘   └──────────────────┘  │
+│       │                                               │
+│       ▼                                               │
+│  ┌──────────┐   ┌──────────┐                          │
+│  │ M7 日报  │──▶│ doorcome │                          │
+│  │ 生成     │   │ 上传     │                          │
+│  └──────────┘   └──────────┘                          │
+│       │                                               │
+│       ▼                                               │
+│  ┌────────────────────────────────────────────────┐   │
+│  │ M8 MCP 服务(Cherry Studio / Claude Code)      │   │
+│  └────────────────────────────────────────────────┘   │
+└──────────────────────────────────────────────────────┘
+
+ +
+关键变更:海外服务器已于 2026-07-14 停用。全链路在 Pi 独立运行,通过 Privoxy → SOCKS5 (ss-local) 代理访问海外新闻网站。
+反爬策略:2026-07-23 更新 — 启用 Crawl4AI magic 全自动反检测 + Playwright stealth 模式。investing.com 改用 Google News RSS 代理。 +
+ + +

二、部署指南

+ +

2.1 环境要求

+ + +

2.2 初始化安装

+
+# 1. 克隆仓库
+git clone ssh://gitea:2222/simon/intl_news /home/pi/intlnews
+cd /home/pi/intlnews
+
+# 2. Python 环境
+uv sync
+
+# 3. 环境变量
+cp .env.example .env
+# 填入: DEEPSEEK_API_KEY, DASHSCOPE_API_KEY, QDRANT_URL
+
+# 4. Xvfb 虚拟显示器
+sudo apt install xvfb
+Xvfb :99 -screen 0 1280x1024x24 -ac +extension RANDR &
+
+# 5. Shadowsocks + Privoxy(海外代理)
+sudo apt install shadowsocks-libev privoxy
+# 配置 /etc/shadowsocks-libev/config.json
+# 配置 /etc/privoxy/config: forward-socks5t / 127.0.0.1:1088 .
+sudo systemctl enable --now shadowsocks-libev-local
+sudo systemctl enable --now privoxy
+
+ +

2.3 定时调度(crontab)

+
+# crontab -e 添加:
+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
+@reboot Xvfb :99 -screen 0 1280x1024x24 -ac +extension RANDR &
+
+ + +

三、操作命令

+ +

3.1 全流程运行

+
+# 一键全流程(M1→M6→日报)
+bash scripts/domestic_full.sh
+
+ +

3.2 M1 抓取

+
+# 抓取全部 13 个源
+bash scripts/domestic_crawl_8g.sh
+
+# 单源调试
+bash scripts/domestic_crawl_8g.sh investing
+bash scripts/domestic_crawl_8g.sh investinglive
+bash scripts/domestic_crawl_8g.sh reuters
+
+ +

3.3 M2→M6 管道

+
+# 完整管道(需要先有 raw 数据)
+bash scripts/pipeline.sh
+
+# 或逐步执行:
+PYTHONPATH=. .venv/bin/python3 -c "from scheduler.pipeline import run_pipeline; run_pipeline('$(date +%Y%m%d)')"
+
+ +

3.4 日报

+
+# 生成当日日报
+PYTHONPATH=. .venv/bin/python3 -c "from scheduler.reporter import generate_report; print(generate_report())"
+
+# 查看日报列表
+ls -lt data/reports/
+
+ +

3.5 日志查看

+
+# 全量日志
+tail -100 logs/full.log
+
+# 筛选指定源
+grep 'investing\|investinglive' logs/full.log | tail -20
+
+ + +

四、新闻源状态

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ID策略日产量状态
ReutersreutersGoogle News RSS~30 篇摘要 DataDome
CNBCcnbcCNBC RSS~25 篇正常
MarketWatchmarketwatchRSS + stealth~25 篇正常
Financial TimesftFT RSS~20 篇摘要 付费墙
Yahoo Financeyahoo_financeYahoo RSS~30 篇正常
Investing.cominvestingGoogle News RSS + stealth25 篇已修复 RSS 代理
Seeking AlphaseekingalphaRSS + stealth~20 篇正常
Barron'sbarronsDow Jones RSS + stealth~20 篇正常
WSJwsjDow Jones RSS + stealth~20 篇正常
EconomisteconomistRSS + stealth~15 篇正常
InvestingLiveinvestingliveRSS(全文)25 篇2026-07-23 新增
ZeroHedgezerohedgeFeedBurner RSS~15 篇正常
ForexLiveforexlive已移除 301→investinglive
+ +
+⚠️ 注意:RSS 摘要源的全文依赖 headful Playwright 回退抓取,成功率取决于代理线路质量。investing.com 因 Cloudflare 反爬,全文抓取间歇性失败。 +
+ + +

五、数据存储

+ +
+/home/pi/intlnews/
+├── data/
+│   ├── raw/{source_id}/{yyyymmdd}/     M1 原始抓取(.html + .md + index.jsonl)
+│   ├── processed/{source_id}/           M2 正文提取结果
+│   ├── dedup/                            M3 去重指纹库(SQLite)
+│   ├── translations/{yyyymmdd}/         M4 翻译+事件抽取(JSONL)
+│   ├── embeddings/{yyyymmdd}/           M5 向量文件(JSONL)
+│   ├── reports/                          M7 日报(HTML)
+│   └── vectorstore/                      M6 Qdrant 本地数据
+├── configs/
+│   ├── sources.yaml                     新闻源定义(13 个源)
+│   ├── system.yaml                      系统参数
+│   └── profiles/8g_headful.yaml         Pi 抓取配置
+├── logs/full.log                        运行日志
+└── prompts/                             LLM Prompt 模板
+
+ + +

六、MCP 服务

+ +

M8 模块提供 MCP(Model Context Protocol)服务,供 Cherry Studio / Claude Code / Cursor 等客户端接入。

+ +

6.1 启动

+
+cd /home/pi/intlnews
+PYTHONPATH=. .venv/bin/python3 -m mcp_server.server
+
+ +

6.2 可用工具

+ + + + + + + +
Tool参数功能
en_news_searchquery, top_k语义搜索知识库
en_news_filtersource_id, date, sentiment按条件筛选事件
en_news_trendingdays获取近期热点
en_news_report获取最新日报
en_news_daily_brief一键生成简报
+ + +

七、配置参考

+ +

7.1 环境变量(.env)

+ + + + + +
变量用途
DEEPSEEK_API_KEYDeepSeek LLM(翻译+事件抽取)
DASHSCOPE_API_KEYDashScope Embedding(向量生成)
QDRANT_URLQdrant 服务地址
+ +

7.2 新闻源配置(sources.yaml)

+

每个源包含:id, name, homepage, rss_url, article_url_pattern, anti_bot_mode 等。

+

新增源时参考现有格式,启用/禁用通过 enabled: true/false

+ +

7.3 Profile 配置

+

Pi 服务器使用 8g_headful profile(环境变量 EN_NEWS_PROFILE),通过 Privoxy HTTP 代理访问海外网站。

+ + + +

八、常见排障

+ + + + + + + + + + + + + + + + + + + + + + + +
现象排查步骤
抓取 0 篇 + 1. 检查 logs/full.log 看 RSS/Web 错误
+ 2. bash scripts/domestic_crawl_8g.sh <source_id> 单源测试
+ 3. 检查代理是否正常:curl -I --proxy 127.0.0.1:3128 https://example.com +
RSS 超时 + 1. 确认 Shadowsocks 和 Privoxy 在运行
+ 2. systemctl status shadowsocks-libev-local privoxy
+ 3. 环境变量 HTTP_PROXY 是否设置 +
Cloudflare 拦截 + 1. 已启用 magic + stealth 自动反检测
+ 2. 仍失败则需更换代理 IP(数据中心 IP 被标记)
+ 3. 改用 Google News RSS 代理(已为 investing/reuters 启用) +
日报无数据 + 1. 检查 data/translations/{date}/ 是否有 JSONL
+ 2. 检查 data/embeddings/{date}/ 是否有向量 +
MCP 连接失败 + 1. 确认 MCP 服务进程在运行
+ 2. 检查端口监听:ss -tlnp | grep 8080 +
+ + +

九、变更记录

+ + + + + + + + + + + +
日期变更
2026-07-23 + 反爬策略增强:
+ - crawler.py: magic/stealth/--disable-webrtc/remove_consent_popups
+ - rss_crawler.py: httpx 代理支持
+ - investing.com: Google News RSS 代理(绕过 Cloudflare)
+ - forexlive → investinglive 迁移(域名已 301 重定向) +
2026-07-14 + - 海外服务器停用,Pi 全链路独立运行
+ - 8g_headful profile 新增(headful + HTTP 代理)
+ - Shadowsocks + Privoxy 部署 +
+ + + +
+ +