google-news-api-skill
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseGoogle News Automation Skill
Google News自动化Skill
📖 Introduction
📖 简介
This skill provides a one-stop news collection service using BrowserAct's Google News API template. It extracts structured news results directly from Google News, including headlines, sources, publication times, and article links, providing clean and ready-to-use data without manual scraping.
本Skill借助BrowserAct的Google News API模板,提供一站式新闻采集服务。它可直接从Google News提取结构化新闻结果,包括标题、来源、发布时间和文章链接,无需手动爬取即可提供干净可用的数据。
✨ Features
✨ 功能特性
- No Hallucinations: Uses predefined workflows to ensure stable and accurate data extraction, avoiding AI-generated hallucinations.
- No CAPTCHA Issues: Built-in mechanisms to bypass reCAPTCHA or other verification challenges automatically.
- No IP Restrictions: Overcomes regional IP limitations and geofencing for stable global access.
- Fast Execution: Executes tasks significantly faster than pure AI-driven browser automation.
- Cost-Effective: Reduces data acquisition costs compared to token-heavy AI solutions.
- 无幻觉生成:使用预定义工作流确保数据提取稳定准确,避免AI生成的幻觉内容。
- 无验证码问题:内置机制可自动绕过reCAPTCHA或其他验证挑战。
- 无IP限制:突破区域IP限制和地理围栏,实现稳定的全球访问。
- 执行快速:执行任务的速度显著快于纯AI驱动的浏览器自动化工具。
- 成本经济:与依赖大量令牌的AI解决方案相比,降低了数据获取成本。
🔑 API Key Guidance
🔑 API密钥指引
Before running, check for the environment variable. If it is not set, do not proceed with other actions. Instead, request and wait for the user to provide the key.
Agent must inform the user:
BROWSERACT_API_KEY"Since the BrowserAct API Key is not configured, please go to the BrowserAct Console to get your Key and provide it to me here."
运行前请检查环境变量是否已设置。若未设置,请勿进行其他操作,需请求并等待用户提供密钥。
Agent必须告知用户:
BROWSERACT_API_KEY"由于尚未配置BrowserAct API密钥,请前往BrowserAct控制台获取您的密钥并在此提供给我。"
🛠️ Input Parameters Details
🛠️ 输入参数详情
The Agent should configure the following parameters based on user needs when calling the script:
-
Search_Keywords
- Type:
string - Description: The keywords to search on Google News (e.g., company name, industry terms, competitor names).
- Example: ,
Generative AI,TeslaSpaceX
- Type:
-
Publish_date
- Type:
string - Description: Filters news based on publication time.
- Options:
- : No time restriction.
any time - : Within the last few hours (best for breaking news).
past hours - : Within the last 24 hours (recommended for daily monitoring).
past 24 hours - : Within the last week (short-term trend analysis).
past week - : Within the last year (long-term research).
past year
- Default:
past week
- Type:
-
Datelimit
- Type:
number - Description: Maximum number of news items to extract in a single task.
- Default:
30 - Recommendation: Use 10-30 for real-time monitoring; use larger values for deep research.
- Type:
Agent在调用脚本时,需根据用户需求配置以下参数:
-
Search_Keywords
- 类型:
string - 描述:在Google News上搜索的关键词(例如:公司名称、行业术语、竞品名称)。
- 示例:、
Generative AI、TeslaSpaceX
- 类型:
-
Publish_date
- 类型:
string - 描述:根据发布时间筛选新闻。
- 选项:
- :无时间限制。
any time - :过去数小时内(最适合突发新闻)。
past hours - :过去24小时内(推荐用于日常监控)。
past 24 hours - :过去一周内(短期趋势分析)。
past week - :过去一年内(长期研究)。
past year
- 默认值:
past week
- 类型:
-
Datelimit
- 类型:
number - 描述:单次任务中可提取的最大新闻数量。
- 默认值:
30 - 建议:实时监控使用10-30条;深度研究可使用更大数值。
- 类型:
🚀 How to Call (Recommended)
🚀 调用方式(推荐)
The Agent should execute the following command to get results:
bash
undefinedAgent应执行以下命令以获取结果:
bash
undefinedExample call
示例调用
python -u ./scripts/google_news_api.py "search keywords" "time range" limit
undefinedpython -u ./scripts/google_news_api.py "search keywords" "time range" limit
undefined⏳ Progress Monitoring
⏳ 进度监控
Since this task involves automated browser operations, it may take several minutes. The script will continuously output timestamped status logs (e.g., ).
Agent Note:
[14:30:05] Task Status: running- Stay focused on the terminal output while waiting for the script.
- As long as new status logs are being printed, the task is running normally. Do not assume it is hung or unresponsive.
- Only consider retrying if the status remains unchanged for a long time or the script stops without returning results.
由于该任务涉及自动化浏览器操作,可能需要数分钟时间。脚本会持续输出带时间戳的状态日志(例如:)。
Agent注意事项:
[14:3OPx:05] Task Status: running- 等待脚本运行时,请关注终端输出。
- 只要有新的状态日志输出,即表示任务正常运行,请勿认为任务已挂起或无响应。
- 仅当状态长时间未更新或脚本停止运行且未返回结果时,才考虑重试。
📊 Output Data Specification
📊 输出数据规范
Upon success, the script prints results parsed from the API response. Fields include:
- : Title of the news article.
headline - : Publisher or news outlet.
source - : Resolved destination URL of the article.
news_link - : Timestamp displayed on Google News.
published_time - : Name of the author (if available).
author
任务成功后,脚本会打印从API响应中解析出的结果。包含字段:
- :新闻文章标题。
headline - :发布商或新闻机构。
source - :文章的解析目标URL。
news_link - :Google News上显示的时间戳。
published_time - :作者姓名(若可用)。
author
⚠️ Error Handling & Retry Mechanism
⚠️ 错误处理与重试机制
If an error occurs (e.g., network issues or task failure), follow this logic:
-
Check Output:
- If output contains , the API Key is invalid. Do not retry. Guide the user to provide a correct API Key.
"Invalid authorization" - If output does not contain but the task fails (e.g., output starts with
"Invalid authorization"or result is empty), the Agent should automatically retry once.Error:
- If output contains
-
Retry Limit:
- Automatic retry is limited to one attempt. If it fails again, stop and report the error message to the user.
若发生错误(例如:网络问题或任务失败),请遵循以下逻辑处理:
-
检查输出:
- 若输出包含,表示API密钥无效。请勿重试,引导用户提供正确的API密钥。
"Invalid authorization" - 若输出不包含但任务失败(例如:输出以
"Invalid authorization"开头或结果为空),Agent应自动重试一次。Error:
- 若输出包含
-
重试限制:
- 自动重试仅限一次。若再次失败,请停止操作并将错误信息告知用户。
🌟 Typical Use Cases
🌟 典型使用场景
- Industry Trend Tracking: Find the latest developments in fields like "Low-altitude economy" or "Generative AI".
- PR Monitoring: Monitor media exposure of a specific brand or company over the past 24 hours.
- Competitor Intelligence: Collect information on new products or marketing activities from competitors over the past week.
- Market Research: Get popular reports on specific keywords across different time dimensions.
- Individual Tracking: Retrieve the latest news reports on industry leaders or public figures.
- Daily News Summary: Automatically extract and summarize daily news in specific domains.
- Global Breaking News: Get real-time updates on major global events.
- Structured Data Extraction: Extract structured information like headlines, sources, and links for analysis.
- Media Exposure Analysis: Evaluate the propagation heat of a project or event in mainstream news media.
- Long-term Research: Retrieve all in-depth reports on a specific technical topic from the past year.
- 行业趋势追踪:了解“低空经济”或“Generative AI”等领域的最新动态。
- 公关监控:监控特定品牌或公司过去24小时内的媒体曝光情况。
- 竞品情报收集:收集过去一周内竞品的新产品或营销活动信息。
- 市场调研:获取不同时间维度下特定关键词的热门报道。
- 人物追踪:检索行业领袖或公众人物的最新新闻报道。
- 每日新闻汇总:自动提取并汇总特定领域的每日新闻。
- 全球突发新闻:获取全球重大事件的实时更新。
- 结构化数据提取:提取标题、来源、链接等结构化信息用于分析。
- 媒体曝光分析:评估项目或事件在主流新闻媒体中的传播热度。
- 长期研究:检索过去一年内特定技术主题的所有深度报道。