News API for Developers: How to Aggregate News from Search Engines
Why News Aggregation Matters
Staying informed is no longer optional for businesses. Whether you are tracking competitor announcements, monitoring industry trends, or building a media intelligence platform, access to timely news data is critical. Manual news monitoring does not scale, and traditional RSS feeds cover only a fraction of the news published online each day.
News aggregation through search engine APIs solves this problem by providing real-time access to the same news results that appear on Google News and Yahoo News. These search engines crawl thousands of news sources worldwide and rank articles by relevance and recency, giving developers access to a curated, up-to-date news feed for any topic.
For developers building media monitoring tools, content discovery platforms, or competitive intelligence dashboards, a news search API is the foundation that makes everything else possible.
The Landscape of Existing Solutions
The news API space has changed significantly over the years. Google deprecated its dedicated News API years ago, leaving developers scrambling for alternatives. While services like NewsAPI.org filled some of the gap, they come with limitations: restricted free tiers, delayed results, and coverage gaps for non-English sources.
Traditional RSS-based approaches require you to manually subscribe to individual sources. This works for a handful of publications but falls apart when you need comprehensive coverage of a topic across hundreds of outlets.
Search engine news results offer a fundamentally different approach. Instead of subscribing to sources, you search by topic and get results from every indexed news source. This means you automatically discover new publications covering your topics without maintaining a source list.
Why Search-Based News Is Better
- Automatic source discovery -- New publications are included as they get indexed
- Relevance ranking -- Results are sorted by relevance, not just publication time
- Global coverage -- Access to news from any country using the country parameter
- No source management -- No need to maintain RSS feed lists or publication databases
How Search Engine News Works
Search engines maintain a dedicated news index separate from their main web index. This index prioritizes content from recognized news publishers and updates much more frequently than the regular web index. When you search for news, the engine returns articles from this specialized index, ranked by a combination of recency, relevance, source authority, and topical match.
The Serpent API exposes this news index through a dedicated endpoint. GET /api/news reads the news index instead of the regular web index, and the results include article titles, URLs, publication sources, publish times, and snippets.
Using the Serpent API News Endpoint
News is its own endpoint -- /api/news -- not a mode of the web search endpoint. It takes the same q parameter as web search, and your key travels in the X-API-Key header:
GET https://apiserpent.com/api/news?q=artificial+intelligence
Headers:
X-API-Key: sk_live_your_api_key
Available parameters for news search:
- q (required) -- Your search query
- num (optional) -- Number of articles to return, up to 50
- engine (optional) --
google(default),yahoo,bing,ddg, orbrave - country (optional) -- Country code for localized news (e.g.,
us,uk,de) - freshness (optional) -- Time window:
h/1h,d/1d,7d,w,m/1m,y/1y - sort (optional) --
relevance(default) ordate - language (optional) -- Two-letter ISO code (e.g.,
en,es,de) - format (optional) --
full(default) orsimplefor a trimmed payload
A successful response carries the articles under results.articles. Each entry has position, title, url, source, publishedTime, and snippet.
Code Examples: Node.js and Python
Node.js Example
const API_KEY = 'sk_live_your_api_key';
async function fetchNews(query, options = {}) {
const params = new URLSearchParams({
q: query,
num: options.num || 20,
engine: options.engine || 'google',
...(options.country && { country: options.country })
});
const response = await fetch(
`https://apiserpent.com/api/news?${params}`,
{ headers: { 'X-API-Key': API_KEY } }
);
if (!response.ok) {
throw new Error(`API error: ${response.status}`);
}
return response.json();
}
// Fetch latest AI news
async function main() {
const data = await fetchNews('artificial intelligence breakthroughs', {
num: 20,
country: 'us'
});
if (data.success && data.results.articles) {
data.results.articles.forEach((article, i) => {
console.log(`${i + 1}. ${article.title}`);
console.log(` Source: ${article.source}`);
console.log(` Published: ${article.publishedTime}`);
console.log(` URL: ${article.url}`);
console.log('');
});
}
}
main();
Python Example
import requests
from datetime import datetime
API_KEY = 'sk_live_your_api_key'
def fetch_news(query, num=20, engine='google', country=None):
"""Fetch news articles from Serpent API."""
params = {
'q': query,
'num': num,
'engine': engine
}
if country:
params['country'] = country
response = requests.get(
'https://apiserpent.com/api/news',
params=params,
headers={'X-API-Key': API_KEY}
)
response.raise_for_status()
return response.json()
# Fetch and display tech news
results = fetch_news('cloud computing trends', num=15, country='us')
if results.get('success'):
articles = results.get('results', {}).get('articles', [])
for i, article in enumerate(articles, 1):
print(f"{i}. {article.get('title')}")
print(f" Source: {article.get('source')}")
print(f" Published: {article.get('publishedTime')}")
print()
Building a News Aggregator
Let us build a practical news aggregator that monitors multiple topics, deduplicates results, and stores them for later analysis.
const fs = require('fs');
class NewsAggregator {
constructor(apiKey) {
this.apiKey = apiKey;
this.articles = new Map(); // URL -> article for dedup
}
async fetchTopic(topic, options = {}) {
const params = new URLSearchParams({
q: topic,
num: options.num || 20,
engine: options.engine || 'google'
});
const response = await fetch(
`https://apiserpent.com/api/news?${params}`,
{ headers: { 'X-API-Key': this.apiKey } }
);
const data = await response.json();
if (data.success && data.results.articles) {
for (const article of data.results.articles) {
if (!this.articles.has(article.url)) {
this.articles.set(article.url, {
...article,
topic,
fetchedAt: new Date().toISOString()
});
}
}
}
return data.results.articles?.length || 0;
}
async monitorTopics(topics, options = {}) {
const results = {};
for (const topic of topics) {
const count = await this.fetchTopic(topic, options);
results[topic] = count;
// Rate limiting: wait between requests
await new Promise(r => setTimeout(r, 1500));
}
return results;
}
getArticles() {
return Array.from(this.articles.values())
.sort((a, b) => new Date(b.publishedTime) - new Date(a.publishedTime));
}
save(filepath) {
const articles = this.getArticles();
fs.writeFileSync(filepath, JSON.stringify(articles, null, 2));
return articles.length;
}
}
// Usage
const aggregator = new NewsAggregator('sk_live_your_api_key');
const topics = [
'startup funding',
'tech layoffs',
'artificial intelligence regulation',
'cybersecurity breach'
];
const counts = await aggregator.monitorTopics(topics);
console.log('Articles found per topic:', counts);
const total = aggregator.save('news-digest.json');
console.log(`Saved ${total} unique articles`);
Filtering by Freshness
News relevance decays quickly. An article from three days ago is less valuable than one published an hour ago. Here is how to filter results by publication time:
function filterByFreshness(articles, maxAgeHours = 24) {
const cutoff = new Date();
cutoff.setHours(cutoff.getHours() - maxAgeHours);
return articles.filter(article => {
if (!article.publishedTime) return false;
const pubDate = new Date(article.publishedTime);
return pubDate >= cutoff;
});
}
// Get only articles from the last 6 hours
const freshNews = filterByFreshness(articles, 6);
console.log(`${freshNews.length} articles from the last 6 hours`);
Multi-Keyword Monitoring
For comprehensive monitoring, you often need to track multiple keywords and combine the results. This approach is useful for PR monitoring, competitive intelligence, and industry tracking.
async function monitorKeywords(keywords, apiKey) {
const allArticles = [];
for (const keyword of keywords) {
const params = new URLSearchParams({
q: keyword,
num: 10
});
const response = await fetch(
`https://apiserpent.com/api/news?${params}`,
{ headers: { 'X-API-Key': apiKey } }
);
const data = await response.json();
if (data.success && data.results.articles) {
allArticles.push(...data.results.articles.map(a => ({
...a,
matchedKeyword: keyword
})));
}
await new Promise(r => setTimeout(r, 1000));
}
// Deduplicate by URL
const unique = new Map();
for (const article of allArticles) {
if (!unique.has(article.url)) {
unique.set(article.url, article);
}
}
return Array.from(unique.values());
}
// Monitor your brand and competitors
const articles = await monitorKeywords([
'"Acme Corp" announcement',
'"Acme Corp" partnership',
'competitor name funding'
], 'sk_live_your_api_key');
Real-World Use Cases
Media Monitoring Dashboard
PR teams use news APIs to build internal dashboards that track brand mentions in real-time. By running scheduled searches every hour, they can react quickly to press coverage and measure the impact of PR campaigns. The Serpent API's affordable pricing makes it practical to run frequent checks without budget concerns.
Content Discovery for Publishers
News publishers and content teams use news aggregation to identify trending stories early. By monitoring broad industry keywords and analyzing which topics are generating the most coverage, editorial teams can prioritize their own reporting to match reader interest.
Financial News Monitoring
Investment firms and fintech applications monitor news for specific companies, sectors, and economic events. Real-time news data feeds into sentiment analysis models and trading algorithms. The ability to search by country makes it possible to track market-moving news in specific regions.
Crisis Management
When a crisis hits, organizations need to monitor news coverage in real-time. A news API allows crisis management teams to track how a story evolves, identify which outlets are covering it, and measure the volume of coverage over time. Automated alerts based on search results ensure nothing is missed.
Ready to get started?
Sign up for Serpent API and get 10 free web searches. No credit card required.
Try for FreeExplore: News API · SERP API · Pricing · Try in Playground
FAQ
How do I fetch news articles using the Serpent API?
Send a GET request to https://apiserpent.com/api/news with your query in q and your key in the X-API-Key header. The parameters worth knowing are num (up to 50 articles), engine (google, yahoo, bing, ddg, or brave), country (a two-letter code such as us, uk, or de) for localised coverage, freshness to bound the time window, and sort. Every result carries the headline, the article URL, the publication, a publish date, and a description, all as structured JSON.
Why use a search engine news API instead of RSS feeds?
RSS makes you choose the sources first. That is fine for ten publications and hopeless for a topic covered by hundreds, because every new outlet is a feed somebody has to discover and add by hand. Searching a news index inverts the problem: you name the topic and the sources find themselves. You also get relevance ranking instead of pure reverse-chronology, and country-level coverage without maintaining a separate feed list per market.
How does search engine news indexing work?
Search engines keep a news index separate from their main web index. It is limited to recognised publishers and refreshes far more often than the general crawl, which is why a story can be searchable within minutes of publication. Ranking inside it blends recency, relevance, publisher authority, and topical fit. The /api/news endpoint reads that news index rather than the general web index, which is why the same query returns very different results there.
How do I filter news articles by freshness?
News decays fast — a three-day-old article is worth far less than one from an hour ago. Bound the window at the source with the freshness parameter, which accepts values from an hour up to a year. For anything finer, parse each result’s date field and compare it against your own cutoff. A small filterByFreshness(articles, maxAgeHours) helper with a 6-hour or 24-hour window is usually all a monitoring dashboard needs on top of that.
What can I build with a news search API?
Four patterns come up again and again. Media monitoring, where a PR team runs a scheduled brand search every hour and reacts to coverage the same day. Content discovery, where an editorial team spots a story early by watching which topics suddenly attract many outlets at once. Financial monitoring, where recent coverage feeds a sentiment model with country-level targeting. And crisis tracking, where you follow how a story spreads, which outlets picked it up, and whether volume is still climbing.