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 @@ + + +
+ + +最后更新:2026-07-23 | 运行服务器:pi@192.168.1.160
+ ++┌──────────────────────────────────────────────────────┐ +│ 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) │ │ +│ └────────────────────────────────────────────────┘ │ +└──────────────────────────────────────────────────────┘ ++ +
Privoxy → SOCKS5 (ss-local) 代理访问海外新闻网站。magic 全自动反检测 + Playwright stealth 模式。investing.com 改用 Google News RSS 代理。
++# 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 ++ +
+# 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 & ++ + +
+# 一键全流程(M1→M6→日报) +bash scripts/domestic_full.sh ++ +
+# 抓取全部 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 ++ +
+# 完整管道(需要先有 raw 数据)
+bash scripts/pipeline.sh
+
+# 或逐步执行:
+PYTHONPATH=. .venv/bin/python3 -c "from scheduler.pipeline import run_pipeline; run_pipeline('$(date +%Y%m%d)')"
+
+
++# 生成当日日报 +PYTHONPATH=. .venv/bin/python3 -c "from scheduler.reporter import generate_report; print(generate_report())" + +# 查看日报列表 +ls -lt data/reports/ ++ +
+# 全量日志 +tail -100 logs/full.log + +# 筛选指定源 +grep 'investing\|investinglive' logs/full.log | tail -20 ++ + +
| 源 | ID | 策略 | 日产量 | 状态 |
|---|---|---|---|---|
| Reuters | reuters | Google News RSS | ~30 篇 | +摘要 DataDome | +
| CNBC | cnbc | CNBC RSS | ~25 篇 | +正常 | +
| MarketWatch | marketwatch | RSS + stealth | ~25 篇 | +正常 | +
| Financial Times | ft | FT RSS | ~20 篇 | +摘要 付费墙 | +
| Yahoo Finance | yahoo_finance | Yahoo RSS | ~30 篇 | +正常 | +
| Investing.com | investing | Google News RSS + stealth | 25 篇 | +已修复 RSS 代理 | +
| Seeking Alpha | seekingalpha | RSS + stealth | ~20 篇 | +正常 | +
| Barron's | barrons | Dow Jones RSS + stealth | ~20 篇 | +正常 | +
| WSJ | wsj | Dow Jones RSS + stealth | ~20 篇 | +正常 | +
| Economist | economist | RSS + stealth | ~15 篇 | +正常 | +
| InvestingLive | investinglive | RSS(全文) | 25 篇 | +2026-07-23 新增 | +
| ZeroHedge | zerohedge | FeedBurner RSS | ~15 篇 | +正常 | +
| ForexLive | forexlive | — | — | +已移除 301→investinglive | +
+/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 模板
+
+
+
+M8 模块提供 MCP(Model Context Protocol)服务,供 Cherry Studio / Claude Code / Cursor 等客户端接入。
+ ++cd /home/pi/intlnews +PYTHONPATH=. .venv/bin/python3 -m mcp_server.server ++ +
| Tool | 参数 | 功能 |
|---|---|---|
en_news_search | query, top_k | 语义搜索知识库 |
en_news_filter | source_id, date, sentiment | 按条件筛选事件 |
en_news_trending | days | 获取近期热点 |
en_news_report | — | 获取最新日报 |
en_news_daily_brief | — | 一键生成简报 |
| 变量 | 用途 |
|---|---|
DEEPSEEK_API_KEY | DeepSeek LLM(翻译+事件抽取) |
DASHSCOPE_API_KEY | DashScope Embedding(向量生成) |
QDRANT_URL | Qdrant 服务地址 |
每个源包含:id, name, homepage, rss_url, article_url_pattern, anti_bot_mode 等。
+新增源时参考现有格式,启用/禁用通过 enabled: true/false。
Pi 服务器使用 8g_headful profile(环境变量 EN_NEWS_PROFILE),通过 Privoxy HTTP 代理访问海外网站。
proxy.enabled: true — 启用 HTTP 代理crawler.headful: true — 有头浏览器 + Xvfbcrawler.magic: true — Crawl4AI 全自动反检测crawler.enable_stealth: true — Playwright stealth| 现象 | 排查步骤 |
|---|---|
| 抓取 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 部署 + |
+