DEV Community

Siftwright
Siftwright

Posted on Originally published at siftwright.com

Build a daily news brief in Python with Google News search, billed per article

Need fresh news headlines in a script, a RAG pipeline or a media-monitoring job, without scraping Google or wiring up a paid news API? Here is a small Python brief generator built on the Google News Scraper Apify Actor. It is billed per article returned ($1.50 per 1,000), and an empty or failed search costs nothing.

Input

The Actor takes query, maxItems (1 to 200), language and country. Each result has title, link, source, publishedAt (ISO 8601), snippet and status.

The script

import os
from collections import Counter
import requests

TOKEN = os.environ["APIFY_TOKEN"]
URL = "https://api.apify.com/v2/acts/siftwright~google-news-scraper/run-sync-get-dataset-items"

def news(query, n=10, language="en", country="US"):
    r = requests.post(URL, params={"token": TOKEN},
                      json={"query": query, "maxItems": n, "language": language, "country": country},
                      timeout=180)
    r.raise_for_status()
    return [a for a in r.json() if a.get("status") == "ok"]

watchlist = ["open source LLM", "vector database"]
for q in watchlist:
    items = sorted(news(q), key=lambda a: a["publishedAt"], reverse=True)
    print(f"\n## {q} ({len(items)} articles)")
    for a in items[:3]:
        print(f"- {a['publishedAt'][:10]} {a['source']}: {a['title']}\n  {a['link']}")
    print("top sources:", Counter(a["source"] for a in items).most_common(3))
Enter fullscreen mode Exit fullscreen mode

run-sync-get-dataset-items starts the run and returns the dataset in one HTTP call, which suits short jobs like this one.

Real output

I ran it on 2026-10-18 with a watchlist of two queries and 10 articles each. Sorted newest first, the top hit for "open source LLM" was a HackerNoon piece dated 2026-10-18 on GPU memory for running open LLMs locally, and for "vector database" an article dated 2026-10-13 about Elastic's serverless vector database. Your results will differ as the news changes.

Two notes from testing:

  • link values are Google News redirect URLs. They open the article in a browser, but if you need the publisher URL you have to resolve the redirect yourself.
  • snippet is often just the title plus the outlet name, so don't count on it for body text.

Variations

  • Change language and country (for example de and DE) to read another Google News edition.
  • Schedule the same Actor on Apify and send the dataset to a webhook for daily monitoring.
  • It also works with AI agents through Apify's MCP server, so an assistant can run the search itself.

More details and a curl example: siftwright.com/google-news-api. Questions: support@siftwright.com.

Top comments (0)