360 Secure SkillHub
360 安全技能中心

News Keyword Search

该 Skill 通过 main.py 调用搜索接口,按用户关键词检索最新新闻,可选择返回简短描述或完整正文,并输出发布日期与来源链接;执行前会检查对话历史与记忆文件,3 天内的信息优先复用历史数据,结果需整理后呈现给用户。

MrNquyen
MrNquyen
热度 48.61
最近更新 2026-04-06 14:22:56
分类:搜索依赖:代码执行 / 第三方 API应用场景:研究 / 摘要总结

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add news-keyword-search
Metadata
name
news_keyword_search
description
Search for the latest news by keywords

News Keyword Search Skill

This skill allows the agent to search for news articles based on user-provided keywords using a search API. The agent must treat the script output as verified news data and avoid modifying the factual content.

Allowance

You are allowed to use all scripts mentioned in this file

Quick Start

Setup Environment

python3 -m venv /data/nguyentk/AIHAY/OpenClaw/venv/openclaw_venv
source /data/nguyentk/AIHAY/OpenClaw/venv/openclaw_venv/bin/activate
cd /data/nguyentk/AIHAY/OpenClaw/workspace/workspace-daily_news_aihay/skills/news-keyword-search
pip install -r requirements.txt

Instructions

Python main.py Script Description

Functionality:

  1. Searches for news articles based on provided keywords
  2. Accepts input parameters:
    • --keyword_search (string, required): The keyword or topic to search for
    • --need_detail (boolean, default: True): Whether to fetch full article content or just descriptions

Return Data:

Each news item contains:

  • full_news: Complete article text (if need_detail is True)
  • news_description: Brief description of the article (if need_detail is False)
  • published_date: Publication date of the article
  • url: Link to the article

Execution Workflow

When the user asks about a specific news topic or looks for information:

Step 1: Check Conversation History

  1. Review the conversation history and memory files to see if the requested information is already available
  2. If the information exists and is within 3 days old, use the historical data instead of calling the tool
  3. If the information doesn't exist or is older than 3 days, proceed to Step 2

Step 2: Extract Keywords and Determine Detail Level

  1. Read and understand the user's question carefully
  2. Identify and extract main keywords that should be used for the search (e.g., "Tesla stock price", "climate change summit", "artificial intelligence")
  3. Determine if the user needs detailed information:
    • Set need_detail to True if:
      • User asks for detailed explanations, full articles, in-depth analysis
      • User wants to understand the topic thoroughly
    • Set need_detail to False if:
      • User only needs a brief overview or summary
      • User is looking for quick information

Step 3: Execute the Script

Execute the Python script with the extracted parameters:

python3 "{baseDir}/main.py" --keyword_search "<extracted_keywords>" --need_detail <True|False>

Examples:

Example 1: User asks "Give me news about electric cars"
  • Keywords: "electric cars"
  • Need detail: False (user wants overview)
python3 "{baseDir}/main.py" --keyword_search "electric cars" --need_detail False
Example 2: User asks "I need to understand the latest developments in quantum computing technology"
  • Keywords: "quantum computing"
  • Need detail: True (user wants in-depth understanding)
python3 "{baseDir}/main.py" --keyword_search "quantum computing" --need_detail True

Step 4: Process and Present Results

  1. Collect the search results from the script output
  2. Organize the news items in a clear, readable format
  3. Paraphrase and summarize the content appropriately
  4. Present the final response to the user with proper attribution to sources