DEV Community

Cover image for A free-text brand monitor on Google News in any country (with Python)
Fjord Labs
Fjord Labs

Posted on

A free-text brand monitor on Google News in any country (with Python)

Google Alerts is fine until you need several countries, exact control over the query, or the results as data. Google News search is much better for this, because it accepts the usual operators. Here's how I turn it into a daily brand and competitor monitor that outputs a clean table.

Write the query like a search pro

Google News search understands:

  • "exact phrase" for your brand name
  • OR to cover spellings or products
  • -word to drop noise
  • site:example.com to watch one publisher

So "Fjord Labs" OR fjordlabs -job catches the brand and skips job ads.

The code

I use a hosted Actor I maintain on Apify (Google News Scraper). With the Python client (pip install apify-client pandas):

from apify_client import ApifyClient
import pandas as pd

client = ApifyClient("<YOUR_APIFY_TOKEN>")
run = client.actor("fjordlabs/google-news").call(run_input={
    "queries": ['"heat pump" subsidy', '"Tesla" -stock'],
    "editions": ["US:en", "GB:en", "DE:de", "DK:da"],
    "timeRange": "past_day",
    "maxArticlesPerFeed": 50,
    "deduplicate": True,
})

df = pd.DataFrame(client.dataset(run["defaultDatasetId"]).iterate_items())
print(df[["edition", "query", "publisher", "publishedAt", "title"]].head(20))
Enter fullscreen mode Exit fullscreen mode

Each row has the headline, publisher, publish time, the article URL and related headlines Google groups with it:

{"title": "Heat pump sales surge as subsidies expand", "publisher": "Example Times",
 "publishedAt": "2026-10-16T17:30:00+00:00", "edition": "US:en", "query": "\"heat pump\" subsidy"}
Enter fullscreen mode Exit fullscreen mode

Who covers you most?

print(df.groupby(["edition", "publisher"]).size().sort_values(ascending=False).head(10))
Enter fullscreen mode Exit fullscreen mode

That one line is a decent "share of voice" report when you run it for yourself and two competitors.

Make it a monitor

Schedule it daily with timeRange: "past_day" and add Apify's Slack, email or webhook integration. Articles cost $0.0015 each, and deduplicate removes the same story syndicated across editions, so you don't pay for it twice. You can also use topics (Business, Technology...) or top stories instead of a search.

Disclosure: I built and maintain the scraper. Questions and feature requests welcome in the comments. Links to Apify include my referral code.

Top comments (2)

Collapse
 
fun_fun_19313eced54af3c68 profile image
SoloAgentFlow •

Nice use of the operators. Two things that helped me with daily runs like this: keep a small seen-URLs list (a key-value store works) and only alert on new URLs, since a "past_day" window and a daily schedule can overlap depending on when the run starts, so the same story can show up two days in a row. And for the share-of-voice groupby, normalizing publisher names first ("Reuters" vs "Reuters.com" style variants) makes the counts a lot cleaner.

Collapse
 
fjordlabs profile image
Fjord Labs •

Thanks, great tips! You’re right, the built-in dedupe only works within one run, so a daily “past_day” schedule can definitely repeat a story. A seen-URLs list in a key-value store is a neat fix. And good call on publisher names: grouping by the publisherUrl domain instead of the display name gets rid of most of those variants. Appreciate it! 🙌