Practical News Monitor

v0.1.0

支持地缘政治、石油、黄金等关键词的多数据源新闻监控,自动保存数据并生成摘要报告,易于扩展和定制。

0· 314·0 current·0 all-time

Install

OpenClaw Prompt Flow

Install with OpenClaw

Best for remote or guided setup. Copy the exact prompt, then paste it into OpenClaw for zrisingz-crypto/practical-news-monitor.

Previewing Install & Setup.
Prompt PreviewInstall & Setup
Install the skill "Practical News Monitor" (zrisingz-crypto/practical-news-monitor) from ClawHub.
Skill page: https://clawhub.ai/zrisingz-crypto/practical-news-monitor
Keep the work scoped to this skill only.
After install, inspect the skill metadata and help me finish setup.
Use only the metadata you can verify from ClawHub; do not invent missing requirements.
Ask before making any broader environment changes.

Command Line

CLI Commands

Use the direct CLI path if you want to install manually and keep every step visible.

OpenClaw CLI

Bare skill slug

openclaw skills install practical-news-monitor

ClawHub CLI

Package manager switcher

npx clawhub@latest install practical-news-monitor
Security Scan
VirusTotalVirusTotal
Benign
View report →
OpenClawOpenClaw
Benign
medium confidence
Purpose & Capability
The name/description (news monitor for geopolitics, oil, gold) match the included Python script and SKILL.md. The code implements JSON API and HTML parsing sources, keyword matching, and local persistence — all expected for this functionality.
Instruction Scope
Instructions are limited to installing requests, running the Python script, editing keyword/source configuration, and reading/writing data in a local DATA_DIR. This is within scope. Note: the skill will perform network requests to whatever source URLs are configured and will write files to the user's filesystem (default: ~/shared_memory/practical_news). Users should review configured source URLs before running.
Install Mechanism
No install spec is provided (instruction-only + a code file). SKILL.md advises pip3 install requests — expected for the script. There is no remote download of arbitrary binaries or extract steps. The lack of pinned package versions is a minor maintenance/security note but not an incoherence.
Credentials
The skill requests no environment variables or credentials and does not reference system config paths beyond a user-writable data directory. This is proportional to a news-monitoring tool.
Persistence & Privilege
The skill is not always-enabled, does not request elevated privileges, and only persists its own data files in a configurable local directory. It does not modify other skills or agent-wide configuration in the provided files.
Assessment
This appears to be a benign, self-contained news-monitoring script, but before installing/running: 1) Review and update the source list in _init_sources() so it only queries trusted public endpoints; 2) Change DATA_DIR to a directory you control (avoid running as a privileged user); 3) Inspect the remainder of the Python file (the provided file was truncated in the manifest) to confirm there are no hidden network endpoints or telemetry; 4) Consider pinning the requests dependency (e.g., requests==2.x) and running in a virtualenv; 5) If you plan to run it regularly, run it in a restricted environment or sandbox and monitor its network activity. If you want, I can scan the rest of the file (the truncated portion) or highlight exact lines that write files or perform network requests.

Like a lobster shell, security has layers — review code before you run it.

latestvk97dfacy3y51wfhx1t2yyswt8s83f654
314downloads
0stars
3versions
Updated 1mo ago
v0.1.0
MIT-0

name: practical-news-monitor description: 实用新闻监控框架 - 专注于可工作的数据源和易扩展性,支持地缘政治、石油、黄金等关键词监控 metadata: {"clawdbot":{"emoji":"📰","requires":{"bins":["python3","requests"]}}}

实用新闻监控框架

专注于可工作的数据源和易扩展性,支持地缘政治、石油、黄金等关键词监控。

核心特性

  • 📡 多数据源支持: JSON API 和 HTML 解析两种数据源类型
  • 🎯 关键词监控: 可自定义监控关键词和分类
  • 💾 数据持久化: 自动保存监控数据到 JSON 文件
  • 📊 摘要报告: 自动生成新闻监控摘要报告
  • 🔧 易扩展: 基类设计,轻松添加新数据源

快速开始

安装依赖

pip3 install requests

运行监控

cd /path/to/skill
python3 practical_news_monitor.py monitor

测试数据源

python3 practical_news_monitor.py test

配置说明

监控关键词

在脚本中编辑 MONITOR_KEYWORDS 字典:

MONITOR_KEYWORDS = {
    'geopolitical': ['中东', '伊朗', '以色列', '巴勒斯坦'],
    'oil': ['石油', '原油', '油价', 'OPEC'],
    'gold': ['黄金', '贵金属', '避险', '金价'],
    'sanctions': ['制裁', '禁令', '限制', '封锁'],
    'shipping': ['航运', '海运', '物流', '苏伊士'],
    'conflict': ['冲突', '战争', '打击', '攻击']
}

添加数据源

_init_sources() 方法中添加新的数据源配置:

source_configs = [
    {
        'type': 'json_api',
        'name': '我的JSON API',
        'config': {
            'enabled': True,
            'url': 'https://api.example.com/news',
            'data_path': 'data.items',
            'title_field': 'title',
            'url_field': 'link',
            'time_field': 'published_at',
            'timeout': 15,
            'limit': 20
        }
    },
    {
        'type': 'html_parse',
        'name': '我的HTML网站',
        'config': {
            'enabled': True,
            'url': 'https://example.com/news',
            'parse_rules': {
                'container_selector': r'<div class="news-item">(.*?)</div>',
                'title_selector': r'<a[^>]*>([^<]+)</a>',
                'link_selector': r'href="([^"]+)"'
            },
            'timeout': 15,
            'limit': 20
        }
    }
]

数据目录

默认数据保存位置:

/Users/zenozhou/shared_memory/practical_news/

可以在脚本中修改 DATA_DIR 变量来更改位置。

输出示例

监控运行后会生成:

  1. JSON 数据文件: 包含所有新闻和相关性信息
  2. 摘要报告: Markdown 格式的新闻摘要
============================================================
📊 实用新闻监控
============================================================
监控时间: 2026-03-23 08:30:00

📡 正在获取 新浪财经(示例)...
   ✓ 获取到 20 条新闻
📡 正在获取 东方财富(示例)...
   ✓ 获取到 15 条新闻

✅ 共获取 35 条新闻
📈 相关新闻: 8 条

📊 来源统计:
  新浪财经(示例): 5/20 相关
  东方财富(示例): 3/15 相关

💾 数据已保存: /Users/zenozhou/shared_memory/practical_news/monitor_2026-03-23_083000.json

扩展开发

创建新数据源类型

继承 NewsDataSource 基类并实现 fetch() 方法:

class MyCustomSource(NewsDataSource):
    """我的自定义数据源"""

    def fetch(self) -> List[Dict[str, Any]]:
        """获取新闻数据"""
        # 实现你的数据获取逻辑
        pass

自定义相关性检查

重写 check_relevance() 方法:

def check_relevance(self, title: str, keywords: Dict[str, List[str]]) -> Dict[str, Any]:
    """自定义相关性检查逻辑"""
    # 实现你的相关性检查
    pass

常见问题

Q: 如何添加新的关键词分类?

A: 在 MONITOR_KEYWORDS 字典中添加新的键值对即可。

Q: 数据源返回 HTTP 错误怎么办?

A: 检查 URL 是否正确,是否需要 headers 或 cookies,尝试在浏览器中访问确认。

Q: 如何调整监控频率?

A: 使用 cron 或其他调度工具定期运行脚本。

许可证

MIT License

贡献

欢迎提交 Issue 和 Pull Request!


由 Zbot 自动生成 💥

Comments

Loading comments...