Blog · · 4 min read
Get Google News Headlines With an API
Read the latest Google News headlines on any topic as JSON: title, publisher, link and date. Working code, a news alert example, and the limits to plan for.
News is one of the few kinds of web data that is useful the moment it appears. Marketing teams watch their brand, analysts follow a sector, and founders track competitors. This guide shows how to read the latest Google News headlines on any topic with a single GET request, what each field means, and how to turn the list into a simple daily news digest.
Request headlines
Send a topic, a company or a person as query. Every call needs an API key. New accounts get 100 free credits and a first key is created automatically on sign-up (it is shown once on the dashboard). Sign in at scrapingrabbit.com/login, then send the key in the x-api-key header (a Bearer token also works). The code below reads it from the SCRAPINGRABBIT_API_KEY environment variable, so no key is ever written into your code.
curl -H "x-api-key: $SCRAPINGRABBIT_API_KEY" "https://api.scrapingrabbit.com/v1/google/news?query=solar%20panels"
A successful call costs 5 credits, as the OpenAPI file lists it. Failed calls are not charged.
A shortened real answer, read on 3 December 2026 for the search solar panels when:7d. The real answer held dozens of headlines. We kept four, and cut each link, which is very long:
{
"success": true,
"data": {
"feed_title": "\"solar panels when:7d\" - Google News",
"news_results": [
{
"rank": 1,
"title": "Solar panels earn their place on the landscape",
"link": "https://news.google.com/rss/articles/CBMikAFBVV95cUxO...",
"source": "VTDigger",
"source_link": "https://vtdigger.org",
"date": "2026-11-29T16:07:00.000Z"
},
{
"rank": 4,
"title": "India to decide on extending use of imported solar cells in solar modules",
"link": "https://news.google.com/rss/articles/CBMirgFBVV95cUxP...",
"source": "Reuters",
"source_link": "https://www.reuters.com",
"date": "2026-12-01T07:05:00.000Z"
},
{
"rank": 5,
"title": "Ultrathin layers help a perovskite solar cell turn more blue light into electric charge",
"link": "https://news.google.com/rss/articles/CBMihgFBVV95cUxN...",
"source": "Tech Xplore",
"source_link": "https://techxplore.com",
"date": "2026-12-02T15:40:04.000Z"
},
{
"rank": 9,
"title": "Oxford scientists discover a material that breaks a fundamental rule of solar energy",
"link": "https://news.google.com/rss/articles/CBMib0FVX3lxTE1q...",
"source": "Science Daily",
"source_link": "https://www.sciencedaily.com",
"date": "2026-12-03T03:25:26.000Z"
}
]
}
}
The when:7d part of the search is a Google News operator that asks for the last seven days. It worked in our test, and the dates above all fall inside that week. The OpenAPI file only promises a topic, a company or a person, so treat operators as a bonus and test them before you build on them.
What the fields mean
| Field | Meaning |
|---|---|
feed_title | The search as Google News understood it |
rank | The headline's place in the list, starting at 1 |
title | The headline |
link | A Google News address for the article, which is the key to store for each headline |
source | The publisher's name |
source_link | The publisher's home page |
date | When the article was published, as a UTC timestamp |
The list is not sorted by date. In the answer above, a headline from 3 December sits at rank 9, below older ones. Sort by date yourself if you want newest first.
Build a daily news digest
This code reads the headlines for a topic, keeps those from the last 24 hours, sorts them newest first, and prints a short digest.
async function headlines(query) {
const url = `https://api.scrapingrabbit.com/v1/google/news?query=${encodeURIComponent(query)}`;
const res = await fetch(url, { headers: { "x-api-key": process.env.SCRAPINGRABBIT_API_KEY } });
const body = await res.json();
if (!body.success) return [];
return body.data.news_results;
}
async function digest(query) {
const dayAgo = Date.now() - 24 * 60 * 60 * 1000;
const recent = (await headlines(query))
.filter((item) => new Date(item.date).getTime() >= dayAgo)
.sort((a, b) => new Date(b.date) - new Date(a.date));
for (const item of recent) {
console.log(`${item.date.slice(0, 16)} ${item.source}: ${item.title}`);
console.log(` ${item.link}`);
}
return recent.length;
}
console.log(await digest("solar panels"), "headlines in the last 24 hours");
The code returns an empty list when the call fails, so a failed run prints nothing instead of crashing. It costs 5 credits per run.
The same in Python:
import os
from datetime import datetime, timedelta, timezone
import requests
res = requests.get(
"https://api.scrapingrabbit.com/v1/google/news",
params={"query": "solar panels"},
headers={"x-api-key": os.environ["SCRAPINGRABBIT_API_KEY"]},
timeout=60,
)
body = res.json()
if body.get("success"):
day_ago = datetime.now(timezone.utc) - timedelta(days=1)
items = [
item for item in body["data"]["news_results"]
if datetime.fromisoformat(item["date"].replace("Z", "+00:00")) >= day_ago
]
for item in sorted(items, key=lambda i: i["date"], reverse=True):
print(item["date"][:16], item["source"], "-", item["title"])
Run it on a schedule
Run the digest once a day from a scheduler such as cron, and store the link of each headline you have already seen. Skip a headline when its link is already stored, so you only handle new ones. A daily run for one topic costs 5 credits, about 150 credits a month.
Things to plan for
- Headlines only. You get the title, publisher, link and date, not the article text.
- The list is not sorted by date. Sort by
dateyourself if you want newest first. - The list changes often. It can differ from one hour to the next, so store the time you read it.
- Duplicates happen. In our test the same headline appeared twice in one list. Compare titles or links if you need a unique list.
- Rate limits and credits. Each key is limited per minute: 10 requests on the free plan, 60 on Starter, 120 on Pro and 300 on Scale. A call costs 5 credits, so cache a topic you read often.
- Always check
success. A failed request returnssuccess: false, acodesuch asRATE_LIMITEDorINVALID_API_KEY, and amessage. Failed calls are not charged.
Try it without code
The free Google News search works in the browser with no key and shows the latest headlines for any topic you type.
Try it yourself
Frequently asked questions
What can I search for?
A topic, a company or a person, up to 300 characters. For example solar panels, a brand name or a public figure.
Do the headlines change?
Yes. Headlines come from Google News and change often, so the list can differ from one hour to the next.
Do I get the article text?
No. You get the headline, the publisher, a link and the date, not the article text.