news-trends-api
v1.0.1
Published
News mention volume via the Trends API. Media monitoring without scraping news sites.
Downloads
293
Maintainers
Readme
News mention-volume API
How often a topic is written about. Tone is a different source: news-sentiment-api.
Key: trendsapi.ai/#get-key. Full contract: trendsapi-ai/trendsapi.
Install
npm install news-trends-apiimport { TrendsAPI } from "news-trends-api";
const client = new TrendsAPI({ apiKey: process.env.TRENDSAPI_KEY });
const series = await client.getTimeSeries("federal reserve");
const growth = await client.getGrowth("federal reserve", { percent_growth: ["12M"] });
const headlines = await client.getLive({ limit: 10 });Keyword helpers default to source: "news volume". Override source for any other platform. Official full client: trendsapi.
Call
| Field | Value |
|---|---|
| Endpoint | POST https://api.trendsapi.ai/api |
| Auth | Authorization: Bearer $TRENDSAPI_KEY |
| History | source: news volume with get_time_series or get_growth |
| Keyword | Any phrase, e.g. federal reserve |
| Live type | Google News Top News (headlines now, not history) |
curl -sS -X POST https://api.trendsapi.ai/api \
-H "Authorization: Bearer $TRENDSAPI_KEY" \
-H "Content-Type: application/json" \
--max-time 60 \
-d '{"mode":"get_time_series","source":"news volume","keyword":"federal reserve"}'This source can be slow. If you get HTTP 504 HTML, retry. It is not billed.
source: news sentiment is tone, not mention count. Two calls if you need both.
Site: trendsapi.ai/trends/news-trends.
License
MIT. See LICENSE.
