Zum Hauptinhalt springen
tsecurity.de LIVE
Echtzeit-Radar & Feeds
Alle RSS Feeds
👥 Community & Social
YouTube Security VideosGoogle Cloud Tech: Gemini is coming to your city(24.09.2026 um 15:00 Uhr)
AI & KI NachrichtenGoogle’s latest moonshot to put machine learning in space(24.09.2026 um 15:12 Uhr)
Windows Tipps & SecurityPoll: What's your favorite Surface of 2026?(24.09.2026 um 14:58 Uhr)
Sichere ProgrammierungStreaming Materialized Views for Live Read Models (2026)(24.09.2026 um 15:02 Uhr)
Sichere ProgrammierungA Day Is Not 86400 Seconds: The DST Bug in Your Date Math(24.09.2026 um 15:02 Uhr)
Sichere ProgrammierungSetting up Traefik: reverse proxy with automatic HTTPS(24.09.2026 um 15:02 Uhr)
Sichere ProgrammierungA 200 OK response does not prove a secret leak(24.09.2026 um 15:02 Uhr)
Sichere ProgrammierungHow hot do you like it?(24.09.2026 um 15:05 Uhr)
YouTube Security VideosGoogle Cloud Tech: Gemini is coming to your city(24.09.2026 um 15:00 Uhr)
AI & KI NachrichtenGoogle’s latest moonshot to put machine learning in space(24.09.2026 um 15:12 Uhr)
Windows Tipps & SecurityPoll: What's your favorite Surface of 2026?(24.09.2026 um 14:58 Uhr)
Sichere ProgrammierungStreaming Materialized Views for Live Read Models (2026)(24.09.2026 um 15:02 Uhr)
Sichere ProgrammierungA Day Is Not 86400 Seconds: The DST Bug in Your Date Math(24.09.2026 um 15:02 Uhr)
Sichere ProgrammierungSetting up Traefik: reverse proxy with automatic HTTPS(24.09.2026 um 15:02 Uhr)
Sichere ProgrammierungA 200 OK response does not prove a secret leak(24.09.2026 um 15:02 Uhr)
Sichere ProgrammierungHow hot do you like it?(24.09.2026 um 15:05 Uhr)
Intelligence View
⚡ tsecurity.de Intelligence

Building a Topic Frequency Chart from Google News Headlines

This tutorial shows how to collect Google News data using HasData’s Google News API and visualize the most common topics or keywords in news headlines. We’ll process the data, remove stop words, and create a simple frequency chart with Pyt…

0
↗ Quelle (dev.to)
Reagiere als Erste:r — dein Feedback zählt!

This tutorial shows how to collect Google News data using HasData’s Google News API and visualize the most common topics or keywords in news headlines. We’ll process the data, remove stop words, and create a simple frequency chart with Python.






Table of Contents




  • Introduction

  • Setup

  • Fetching Google News Data

  • Processing Headlines

  • Creating a Frequency Chart

  • Full Code

  • Next Steps

  • Further Reading






Introduction



News data is rich, but raw headlines can be messy. Common words like “the”, “of”, and “in” dominate the text, making it hard to extract meaningful insights. In this guide, we’ll:




  1. Fetch news headlines via HasData’s Google News API.

  2. Extract the highlight.title field from each article.

  3. Count the frequency of meaningful words.

  4. Visualize the top keywords using matplotlib.



This approach is useful for tracking trending topics, analyzing industry coverage, or quickly summarizing news from a specific domain.






Setup



You will need:




  • Python 3

  • requests

  • matplotlib

  • nltk

  • Standard library modules: json, collections.Counter, re




pip install requests matplotlib nltk






You also need to download the stopwords data from NLTK. You can do this by running the following command in Python:




import nltk
nltk.download('stopwords')






Make sure you have a HasData API key. You can get one for free from your HasData dashboard.






Fetching Google News Data



We’ll use the API to fetch headlines from a specific topic. You can change the topicToken to fetch different sections like Technology, Business, or Sports.




import requests
import json

API_KEY = "HASDATA-API-KEY"

params_raw = {
"q": "",
"gl": "us",
"hl": "en",
"topicToken": "CAAqJggKIiBDQkFTRWdvSUwyMHZNREpxYW5RU0FtVnVHZ0pWVXlnQVAB", # Example: Entertainment
}

params = {k: v for k, v in params_raw.items() if v}
news_url = "https://api.hasdata.com/scrape/google/news"
news_headers = {"Content-Type": "application/json", "x-api-key": API_KEY}

resp = requests.get(news_url, params=params, headers=news_headers)
resp.raise_for_status()
data = resp.json()









Processing Headlines



We’ll now extract the titles and filter out common stop words using NLTK's built-in list of stopwords.




from collections import Counter
import re
from nltk.corpus import stopwords

# Load stopwords from NLTK
stop_words = set(stopwords.words('english'))

titles = [item.get("highlight", {}).get("title", "") for item in data.get("newsResults", [])]

words = []
for title in titles:
for word in re.findall(r'\w+', title.lower()):
if word not in stop_words and len(word) > 2:
words.append(word)

counter = Counter(words)
most_common = counter.most_common(20)






Now we have a list of words that appear most frequently in the headlines, excluding common stop words.






Creating a Frequency Chart



Finally, we visualize the results using matplotlib.




import matplotlib.pyplot as plt

if not most_common:
print("No meaningful words.")
else:
labels, counts = zip(*most_common)
plt.figure(figsize=(12,6))
plt.bar(labels, counts, color='skyblue')
plt.xticks(rotation=45, ha='right')
plt.title("Top 20 meaningful words in news headlines")
plt.ylabel("Frequency")
plt.tight_layout()
plt.show()






You should see a clear bar chart showing the most common topics from the headlines.






Full Code






import requests
import json
from collections import Counter
import matplotlib.pyplot as plt
import re
import nltk
from nltk.corpus import stopwords

# Download stopwords if not already downloaded
nltk.download('stopwords')

API_KEY = "HASDATA-API-KEY"

# Parameters for Google News API request
params_raw = {
"q": "",
"gl": "us",
"hl": "en",
"topicToken": "CAAqJggKIiBDQkFTRWdvSUwyMHZNREpxYW5RU0FtVnVHZ0pWVXlnQVAB"
}

params = {k: v for k, v in params_raw.items() if v}

news_url = "https://api.hasdata.com/scrape/google/news"
news_headers = {"Content-Type": "application/json", "x-api-key": API_KEY}

# Fetch news data
resp = requests.get(news_url, params=params, headers=news_headers)
resp.raise_for_status()
data = resp.json()

# Extract titles
titles = [item.get("highlight", {}).get("title", "") for item in data.get("newsResults", [])]

# Load stopwords from NLTK
stop_words = set(stopwords.words('english'))

# Process words from titles
words = []
for title in titles:
for word in re.findall(r'\w+', title.lower()):
if word not in stop_words and len(word) > 2:
words.append(word)

# Count words
counter = Counter(words)
most_common = counter.most_common(20)

# Plot results
if not most_common:
print("No meaningful words.")
else:
labels, counts = zip(*most_common)
plt.figure(figsize=(12,6))
plt.bar(labels, counts)
plt.xticks(rotation=45, ha='right')
plt.title("Top 20 meaningful words in news headlines")
plt.ylabel("Frequency")
plt.tight_layout()
plt.show()









Next Steps




  • Expand the stop words list to filter more common words.

  • Analyze key topics using bigrams or trigrams for richer insights.

  • Combine multiple topic sections to see trends across industries.

  • Automate periodic fetching to track trends over time.






Further Reading



If you want to explore more advanced Google News scraping techniques, including RSS feeds, Google Search (tbm=nws), and topic-based scraping, check out our full blog post on HasData: Google News Scraping: RSS, SERP, and Topic Pages.



This article focuses on building a tool for visualizing topic frequencies, but you can combine it with the other methods to build robust pipelines and dashboards for news analysis.

CTI Threat Relationship Graph2 Knoten / 1 Relationen
CVE / Incident Software MITRE ATT&CK CWE Weakness IoC
SOC Incident Playbook: Vulnerability Remediation & Verification
title: Detect Exploitation - Building a Topic Frequency Chart from Google News Headlines
id: 74a55fa0-eaf0-429f-ae7c-ffa0843d7008
status: experimental
description: Automatisch generierte SIEM-Erkennungsregel basierend auf CTI Intelligence
references:
  - https://tsecurity.de/
author: iShareStuff CTI Automated Detection Engine
date: 2026-09-24
logsource:
  category: network_connection
  product: any
detection:
  selection:
      CommandLine|contains:
        - 'exploit'
  condition: selection
falsepositives:
  - Legitime administrative Zugriffe oder Penetrationstests
level: high
tags:
  - attack.initial_access
rule CTI_Threat_Indicator {
    meta:
        author = "iShareStuff CTI Automated Detection Engine"
        date = "2026-09-24"
        description = "YARA Signature for "
    strings:
        $str = "Building a Topic Frequency Cha" ascii wide
    condition:
        any of them
}
tsecurity.de Cognitive Threat RAG
Fokus-Vektor:

Kognitive Analyse für identifizierte Bedrohung: Erhöhte Bedrohungslage im Bereich Building a Topic Frequency Chart from Go.... Basierend auf 368k Vektor-Korrelationen werden sofortige Isolationsmaßnahmen für betroffene Endpunkte empfohlen.

🛡️ Angriffsfläche & Exposure

Netzwerk/Remote-Zugriff ohne Vorauthentifizierung möglich.

Empfohlene Sofortmaßnahmen
  • 1. Perimeter-Inspektion: Relevante Portfreigaben und exponierte Endpunkte unverzüglich scannen.
  • 2. Patch-Applikation: Hersteller-Hotfix einspielen oder betroffene Daemons in isolierte DMZ-Segmente überführen.
  • 3. Telemetrie & EDR-Alerts: Prozessaufrufe und Child-Processes auf anomale Shell-Spawns überwachen.
🔗 Semantisch verwandte Zero-Days MariaDB 11.7 VEC
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Building a Topic Frequency Chart from Google News Headlines

Thematisch verwandte Begriffe: Building, Topic, Frequency, Chart · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-97179 | A security vulnerability has been detected in O2OA up to 9.5.3/10.0.2. T…
Advisory →
TTS Reader • tsecurity.de Voice
tsecurity.de Icon
tsecurity.de App
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag
Themen-Radar & Intelligence Matrix
Echtzeit-Taxonomie nach Angriffsvektoren & Plattformen

tsecurity.de Live Threat Radar

🔴 LIVE RADAR
MONITORING
AKTIV
CVE-DATENBANK
LIVE
🔍
Community Radar & Live Chat
Sentinel Bot online • Live-Stream
Dein Cluster: Security Explorer
Match:
lädt…
Verbindung zum Community-Stream wird aufgebaut...
Bearbeitungsmodus — Senden überschreibt deine Nachricht
Community-Puls — was gerade passiert
lädt…
Aktivitäten deiner Analysten
lädt…
Neues Thema oder Eilmeldung einreichen

Reiche interessante Links, Zero-Days oder Debatten ein. Die Community entscheidet per Upvote über die Veröffentlichung.

Heiß diskutierte Einreichungen
🔖 Gespeicherte Artikel
📂 Keine gespeicherten Artikel vorhanden.
Zurück Ziehen Vor
Links: vorheriger Artikel Rechts: nächster Artikel unten: schließen
News NIS-2 Frühwarnung Tier-1 Intel TTP ⏱️ 3 Min vor 10 Min
Artikeldaten werden geladen...

Zurück: vorheriger Vor: nächster
↗ Original-Quelle
Social Reaktionen Deine Reaktion zählt
Einstufung & Relevanz-Poll 0 Stimmen
In sozialen Netzwerken teilen 1-Klick