newsapi-search について
NewsAPIで記事や速報を検索するNode.jsスキルです。ニュースの調査やモニタリングに向けて、期間、配信元、ドメイン、言語、検索条件による絞り込みとJSON形式の結果取得に対応しています。
主な機能
- 01NewsAPIの記事検索
- 02速報の取得
- 03期間・配信元・ドメイン・言語で絞り込み
- 04高度な検索構文の利用
- 05国・カテゴリ・言語別の配信元一覧
- 06JSON形式で結果を出力
活用シーン
- 01特定テーマの最近の記事を探す
- 02国やカテゴリ別に速報を追う
- 03指定した媒体に結果を限定する
- 04言語別に利用可能な配信元を確認する
インストール
コマンドをコピーしてターミナルで実行します。
$
npx skills add https:/ / github.com/ kirkluokun/ awesome-a-stock-openclawskills --skill newsapi-searchインストール後、Claude Code で/newsapi-searchを入力して読み込まれたか確認します。
同梱ファイル
SKILL.md と一緒にインストールされる参考資料やスクリプト。
_meta.json.env.examplereferences/api-reference.mdexamples.mdscripts/search.jssources.js詳細
NewsAPI 検索
NewsAPI を通じて、5,000 以上のニュースソースを検索します。包括的な記事の検索(/everything)と速報の検索(/top-headlines)に対応しています。
クイックスタート
# Basic search
node scripts/search.js "technology" --days 7
# Filter by quality sources
node scripts/search.js "technology" --sources bbc-news,reuters,al-jazeera-english
# Exclude low-quality domains
node scripts/search.js "technology" --exclude tmz.com,radaronline.com
# Breaking headlines
node scripts/search.js "technology" --headlines --country us
# List available sources
node scripts/sources.js --country us --category general
セットアップ
API キーを ~/.openclaw/.env に追加します。
NEWSAPI_KEY=your_api_key
https://newsapi.org からキーを取得してください(無料プラン:1 日あたり 100 リクエスト)。
エンドポイント
Everything 検索
数百万件の記事を対象とした包括的な検索です。
期間:
node scripts/search.js "query" --hours 24
node scripts/search.js "query" --days 7 # default
node scripts/search.js "query" --weeks 2
node scripts/search.js "query" --months 1
node scripts/search.js "query" --from 2026-01-01 --to 2026-01-31
フィルター:
node scripts/search.js "query" --sources bbc-news,cnn # max 20
node scripts/search.js "query" --domains nytimes.com,bbc.co.uk
node scripts/search.js "query" --exclude gossip-site.com
node scripts/search.js "query" --lang en # or 'any'
検索対象フィールド:
node scripts/search.js "query" --title-only # title only
node scripts/search.js "query" --in title,description # specific fields
高度なクエリ構文:
"exact phrase"— 完全一致+musthave— 必須の単語-exclude— 除外する単語word1 AND word2— 両方が必須word1 OR word2— どちらかを受け入れる(word1 OR word2) AND word3— グループ化
ページネーションと並べ替え:
node scripts/search.js "query" --page 2 --limit 20
node scripts/search.js "query" --sort relevancy # default
node scripts/search.js "query" --sort date # newest first
node scripts/search.js "query" --sort popularity
トップヘッドライン
国またはカテゴリ別の最新速報です。
# By country
node scripts/search.js "query" --headlines --country us
# By category
node scripts/search.js --headlines --country us --category business
# By source
node scripts/search.js --headlines --sources bbc-news,cnn
カテゴリ:business、entertainment、general、health、science、sports、technology
注意: ヘッドラインモードでは、--country/--category と --sources を併用できません。
ソース一覧
node scripts/sources.js # all sources
node scripts/sources.js --country us # filter by country
node scripts/sources.js --category business
node scripts/sources.js --lang en
node scripts/sources.js --json # JSON output
高度な使い方
パラメーターの完全なリファレンスについては、references/api-reference.md を参照してください。
一般的なワークフローと検索パターンについては、references/examples.md を参照してください。
プログラムからの API 利用
const { searchEverything, searchHeadlines, getSources } = require('./scripts/search.js');
const results = await searchEverything('climate change', {
timeWindow: { type: 'days', value: 7 },
sources: 'bbc-news,reuters',
excludeDomains: 'tmz.com',
limit: 20
});
const headlines = await searchHeadlines('business', {
country: 'us',
category: 'business'
});
無料プランの上限
- 1 日あたり 100 リクエスト
- 1 リクエストあたり最大 100 件の結果
- アーカイブ済みコンテンツは 1 か月遅延
出力形式
構造化された JSON を返します。
{
"query": "technology",
"endpoint": "everything",
"totalResults": 64,
"returnedResults": 10,
"page": 1,
"results": [
{
"title": "...",
"url": "...",
"source": "BBC News",
"publishedAt": "2026-02-05T14:30:00Z",
"description": "...",
"content": "..."
}
]
}
コメント
Markdown 対応