Autom
Guias práticos

Monitor Google News

Set up a brand or keyword news alert pipeline that collects and deduplicates Google News articles in real time using the Autom API.

Overview

This playbook builds a news monitoring pipeline: query Google News for a brand name, product, or topic and collect all article titles, sources, and publication dates. Run it on a cron schedule to detect press coverage as soon as it appears.

Prerequisites

  • An Autom API key — get one at app.autom.dev
  • Install dependencies for your language:
pip install requests

Steps

Fetch latest news articles

Call GET /v1/google/news with the keyword you want to monitor.

import requests

API_KEY = "YOUR_API_KEY"

response = requests.get(
    "https://api.autom.dev/v1/google/news",
    headers={"x-api-key": API_KEY},
    params={"query": "OpenAI", "gl": "us", "hl": "en"},
)
data = response.json()

Extract and display articles

Each item in organic_results has title, link, source, date, and snippet.

for article in data.get("organic_results", []):
    print(f"[{article['date']}] {article['title']}")
    print(f"  Source : {article['source']}")
    print(f"  URL    : {article['link']}\n")

Build a monitoring pipeline with deduplication

Store seen article URLs so repeated runs don't produce duplicate alerts.

import json, requests
from pathlib import Path

API_KEY  = "YOUR_API_KEY"
KEYWORDS = ["OpenAI", "Anthropic", "Mistral AI"]
SEEN_FILE = Path("seen_articles.json")

def load_seen() -> set:
    return set(json.loads(SEEN_FILE.read_text())) if SEEN_FILE.exists() else set()

def save_seen(seen: set) -> None:
    SEEN_FILE.write_text(json.dumps(list(seen)))

def fetch_news(query: str) -> list:
    r = requests.get("https://api.autom.dev/v1/google/news",
        headers={"x-api-key": API_KEY}, params={"query": query, "gl": "us", "hl": "en"})
    return r.json().get("organic_results", [])

seen        = load_seen()
new_articles = []

for keyword in KEYWORDS:
    for article in fetch_news(keyword):
        if article["link"] not in seen:
            seen.add(article["link"])
            new_articles.append({**article, "keyword": keyword})

save_seen(seen)
print(f"Found {len(new_articles)} new article(s):")
for a in new_articles:
    print(f"  [{a['keyword']}] {a['title']} — {a['source']}")

Schedule this script with a cron job (e.g. every hour) or a task scheduler to receive continuous coverage monitoring. Combine multiple keywords in one run to minimize credit usage.

Nesta página