SuperAPI AI 工具集

newsapi-search

编程与开发

查看项目

更新于 10-15 23:46

技能介绍

用途:通过 NewsAPI 搜索 5000+ 新闻来源,支持综合文章检索(/everything)与突发头条(/top-headlines)。

主要能力:按小时、天、周、月或自定义日期范围过滤;按来源(最多 20 个)、域名、排除域名、语言过滤;支持标题或指定字段搜索;支持精确短语、+必需词、-排除词、AND/OR 及分组等高级查询语法;支持分页、排序(relevancy、date、popularity)。头条模式可按国家或分类(business、entertainment、general、health、science、sports、technology)检索,也可按来源检索,但国家/分类不能与来源混用。

使用方式:需在 ~/.openclaw/.env 中配置 NEWSAPI_KEY,密钥从 https://newsapi.org 获取。基本命令如 node scripts/search.js "technology" --days 7;列出来源用 node scripts/sources.js --country us --category general。也提供编程接口 searchEverything、searchHeadlines、getSources。输出为结构化 JSON,含 query、endpoint、totalResults、returnedResults、page 及 results 数组(title、url、source、publishedAt、description、content)。

限制:免费层每天 100 次请求,每次最多 100 条结果,归档内容有 1 个月延迟。更多参数见 references/api-reference.md,常见工作流见 references/examples.md。