Skip to content

A tool to scrape Google News search results with a simple API. Get news articles including title, source, publication date, snippets, and related stories.

Notifications You must be signed in to change notification settings

serpapi/google-news-scraper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 

Repository files navigation

Google News Scraper

Google News scraper

Google News Scraper - A tool to scrape Google News search results with a simple API. Get news articles including title, source, publication date, snippets, and related stories.

We provide the results in a structured JSON format, eliminating the need for parsing, coding, proxies, or any other web scraping headaches for developers.

This tool scrapes news.google.com website, not the Google search - news results tab. You can read the difference in this blog post,

How to scrape Google News?

Using a simple GET request, you can retrieve Google News search results:

https://serpapi.com/search.json?engine=google_news&q=Technology&api_key=YOUR_API_KEY
  • Register for free at SerpApi to get your API Key
  • q parameter: defines the search query you want to search on Google News.
  • gl parameter (optional): defines the country code for localized results.

Code examples

Here are some code examples based on your favorite programming languages.

cURL Integration

curl --get https://serpapi.com/search \
 -d engine="google_news" \
 -d q="Technology" \
 -d api_key="secret_api_key"

Python Integration

Step 1: Create a new main.py file.

Step 2: Install requests package with:

pip install requests

Step 3: Add this code to your file:

import requests
SERPAPI_API_KEY = "YOUR_SERPAPI_API_KEY"

params = {
    "api_key": SERPAPI_API_KEY,
    "engine": "google_news",
    "q": "technology"
}

search = requests.get("https://serpapi.com/search", params=params)
response = search.json()
print(response)

If you're only interested in the news_results, you can print them from the response directly:

print(response["news_results"])

JavaScript Integration

Step 1: Install the SerpApi JavaScript package:

npm install serpapi

Step 2: Create a new index.js file.

Step 3: Add this to your file:

const { getJson } = require("serpapi");
getJson({
  api_key: API_KEY,
  engine: "google_news",
  q: "technology"
}, (json) => {
  console.log(json["news_results"]);
});

Other Programming Languages

While you can use our APIs using a simple GET request with any programming language, you can also see our ready-to-use libraries here: SerpApi Integrations.

Google News Scraper Parameters

Please find the parameters for the Google News API below:

Name Description Requirement
q Parameter defines the search query. Supports operators like site:, when: Optional*
Localization
gl Parameter defines the country code for localization (e.g., us, uk, fr) Optional
hl Parameter defines the language code (e.g., en, es, fr) Optional
Advanced
topic_token Parameter to access news for specific topics (World, Business, etc.) Optional
publication_token Parameter to filter results from specific publishers Optional
section_token Parameter to access sub-sections of topics Optional
story_token Parameter to retrieve full coverage of specific stories Optional
so Parameter defines sort method: 0 (relevance), 1 (date) Optional

*Either q, topic_token, publication_token, or story_token is required.

Visit our documentation for more information on all available parameters.

Available data on Google News (JSON Response)

Google News can return different information from time to time. Here is what the news_results array may contain:

 "news_results": [
    {
      "position": "Integer - Position of the article",
      "title": "String - Article headline",
      "link": "String - URL to the article",
      "source": {
        "name": "String - Publisher name",
        "icon": "String - Publisher icon URL",
        "authors": "Array - Article authors"
      },
      "thumbnail": "String - Article thumbnail image URL",
      "thumbnail_small": "String - Small thumbnail URL",
      "date": "String - Publication date (relative)",
      "iso_date": "String - Publication timestamp (ISO format)",
      "snippet": "String - Brief excerpt from the article",
      "stories": "Array - Related coverage (nested articles)",
      "story_token": "String - Token for fetching full story coverage"
    }
  ],

The API response also includes:

  • menu_links: Navigation topics
  • sub_menu_links: Topic subsections
  • related_topics: Associated topic suggestions
  • related_publications: Related news sources

Use cases

Here are some use cases for the Google News API:

  • Build news aggregation apps with customizable topics.
  • Monitor brand mentions and media coverage.
  • Track industry news and competitor announcements.
  • Create news feeds for specific topics or publications.
  • Build media monitoring tools for PR and communications.
  • Analyze news trends and sentiment over time.

Blog tutorial

Interesting use cases:

Video tutorial

Contacts

Feel free to reach out via contact@serpapi.com.

Check other Google Scrapers from SerpApi.

About

A tool to scrape Google News search results with a simple API. Get news articles including title, source, publication date, snippets, and related stories.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published