Add policy radar report and consolidate scraping methods

- Add policy-analysis-2026-07-20.md: 8-policy analysis for Jul 13-20
  covering water protection, consumption expansion, national health,
  TCM revitalization, carbon peak action plan, and PBC monetary policy
- Update skills/policy-radar/SKILL.md: add section 5 with curl+python3
  scraping scripts as fallback when WebSearch/WebFetch are unavailable
- Renumber sections 5→6, 6→7, 7→8, 8→9

Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
推理链专家
2026-07-20 06:22:27 +00:00
parent 30cdaf8fb7
commit 6ac8fc04c8
2 changed files with 342 additions and 4 deletions
+81 -4
View File
@@ -224,7 +224,84 @@ description: 政策雷达 — 从中国政府公开信息源抓取最新政策
---
## 5. 数据源 URL 速查
## 5. 抓取工具与方法
### 5.1 工具选择
| 工具 | 适用场景 | 缺点 |
|------|----------|------|
| WebSearch | 通用搜索,找最新政策链接 | 依赖配额,可能 403 |
| WebFetch | 获取单个页面全文 | 依赖配额,部分站点证书问题 |
| **curl + python3(推荐)** | 直接 HTTP 请求 + HTML 解析 | 需处理编码和动态页面 |
**当 WebSearch / WebFetch 不可用时,使用 curl + python3 作为降级方案(本方案已在实际运行中验证可用)。**
### 5.2 抓取脚本
#### 5.2.1 获取最新政策列表(gov.cn
```bash
curl -sL --max-time 15 "https://www.gov.cn/zhengce/" 2>/dev/null | python3 -c "
import sys, re
html = sys.stdin.read()
# 提取最新政策列表
items = re.findall(r'<li>\s*<a href=\"([^\"]+)\"[^>]*>\s*([^<]+)\s*</a>\s*<span>\s*([\d-]+)\s*</span>', html)
for url, title, date in items:
title = title.strip()
if title and '2026' in date:
print(f'{date} | {title} | {url}')
"
```
#### 5.2.2 抓取政策正文(gov.cn
```bash
curl -sL --max-time 15 "<页面URL>" 2>/dev/null | python3 -c "
import sys, re
html = sys.stdin.read()
paragraphs = re.findall(r'<p[^>]*>(.*?)</p>', html, re.DOTALL)
for p in paragraphs:
text = re.sub(r'<[^>]+>', '', p).strip()
if text and len(text) > 10:
print(text)
"
```
#### 5.2.3 抓取部委动态列表(以央行为例)
```bash
curl -sL --max-time 15 "https://www.pbc.gov.cn/goutongjiaoliu/113456/113469/index.html" 2>/dev/null | python3 -c "
import sys, re
html = sys.stdin.read()
links = re.findall(r'<a[^>]*href=\"(/goutongjiaoliu/[^\"]+)\"[^>]*>([^<]+)</a>', html)
for href, title in links:
title = title.strip()
if title and len(title) > 5:
print(f'{title} | https://www.pbc.gov.cn{href}')
"
```
#### 5.2.4 处理 404 / 页面不存在
gov.cn 的 `/zhengce/content/` 路径下部分文件 ID 不存在(返回"页面不存在")。判断方法:
```python
if "页面不存在" in html or "您访问的页面不存在" in html:
# 该 URL 无效,跳过
```
### 5.3 抓取注意事项
1. **编码**: gov.cn 和 pbc.gov.cn 均使用 UTF-8curl 直接读取二进制再 decode 即可。
2. **超时**: 建议 `--max-time 15`,避免慢站点阻塞。
3. **反爬**: gov.cn 无严格反爬,但连续抓取间隔 1-2 秒为佳。
4. **动态内容**: gov.cn 政策列表页是服务端渲染,直接 curl 可获取。部委子页面(如 pbc.gov.cn 发文列表)同上。
5. **404 风险**: 政策 URL 可通过列表页 `/zhengce/``<a href>` 确认,不要猜测 content ID 序列。
6. **政策解读页**: gov.cn 政策解读(`/zhengce/jiedu/`)的链接格式与政策原文(`/zhengce/content/`)不同,注意区分。
---
## 6. 数据源 URL 速查
| 来源 | URL | 内容 |
|------|-----|------|
@@ -240,7 +317,7 @@ description: 政策雷达 — 从中国政府公开信息源抓取最新政策
---
## 6. 发布前自检
## 7. 发布前自检
- [ ] **原文可追溯:** 每条政策都有原文链接或原文引文
- [ ] **四步法齐全:** 每条政策都经过4.1→4.2→4.3→4.4四步
@@ -251,7 +328,7 @@ description: 政策雷达 — 从中国政府公开信息源抓取最新政策
---
## 7. 反模式(出现即重写)
## 8. 反模式(出现即重写)
1. **凭空解读:** 没有抓取到原文就开始分析 → 必须至少3条原文
2. **只看标题:** 没有读原文段落就下判断 → 必须读核心段落
@@ -261,6 +338,6 @@ description: 政策雷达 — 从中国政府公开信息源抓取最新政策
---
## 8. 一句话调用
## 9. 一句话调用
> 「运行政策雷达,搜索{关键词/时间范围},抓取政策原文,按四步法解读,输出 policy-analysis.md。」