News Search API
The Google News Search API returns recent news articles related to your search query. Access this endpoint by setting search_type=news
in your request.
Request Format
GET /api/google?search_type=news
Parameters
Parameter | Description | Example | Required | Notes |
---|---|---|---|---|
query | The search term | café | Yes | Must be URL encoded |
location | Geographic location | Paris,Paris,Ile-de-France,France | Yes | Must follow format: City,City,Region,Country |
google_domain | Google domain to use | google.fr | No | Domain name without https://www. |
gl | Google country code | fr | No | Two-letter country code |
hl | Interface language | fr | No | Two-letter language code |
search_type | Type of search | news | Yes | Must be set to news |
device | Device type | desktop | No | Options: desktop or mobile |
page | Page number | 1 | No | Range: 1-100 |
Response Format
{
"news": Array<{
url: string, // URL of the news article
title: string, // Article headline
content: string, // Article snippet/description
source: string, // News source name
date: string, // Publication date/time
thumbnail: string // URL of article thumbnail image
}>,
"metadata": {
status: string, // Success/failure status
request_id: string, // Unique identifier for request
created_at: string, // Request timestamp
updated_at: string, // Response timestamp
params: { // Echo of request parameters
query: string,
location: string,
google_domain: string,
gl: string,
hl: string,
search_type: string,
page: string | null,
device: string
}
}
}
Example Request
curl -X 'GET' \
'https://app.serpextractor.com/api/google?query=café&location=Paris%2CParis%2CIle-de-France%2CFrance&google_domain=google.fr&gl=fr&hl=fr&search_type=news&device=desktop' \
-H 'accept: */*' \
-H 'X-API-Key: YOUR_API_KEY'
Response Fields
News Article Object
Field | Type | Description |
---|---|---|
url | string | Direct link to the news article |
title | string | Article headline |
content | string | Brief excerpt or description of the article |
source | string | Name of the publishing organization |
date | string | Relative or absolute publication timestamp |
thumbnail | string | URL of the article's thumbnail image |
Pagination
News search results support pagination:
- Results are typically returned in batches of 10
- Page parameter accepts values from 1-100
- Empty results indicate end of available pages
- News articles are sorted by date (most recent first)
Error Handling
Status Code | Description |
---|---|
200 | Success |
400 | Invalid parameters |
401 | Invalid or missing API key |
429 | Too many concurrent connections |
500 | Server error |
tip
When working with news results:
- Regularly refresh results to get the latest news
- Handle relative dates appropriately
- Verify thumbnail availability before displaying, as not all news articles will have a thubnail
caution
- News articles may become unavailable over time
- Thumbnail URLs may expire
- Publication dates are in the timezone of the news source
- Article content may be truncated in the snippet