Companion code for a YouTube video showing how to track brand mentions with Google SERP API HasData Google SERP API.
Tutorial project: Query brand mentions from Google, Instagram, Facebook, Tiktok, X etc. Infrence them with AI to extract information, save data as CSV files and Graph images, then periodically send new mentions and insights to Telegram chat.
This repository runs main.py to do the following:
- Read the settings files, where user inputs the brand description, brand name, brand domain
- Uses HasData Google SERP API to find all mentions of the brand.
- Uses AI to inference and extract information in a structured way
- Saves the results in the repo output folder with these formats: CSV, Graph Image PNG
- Sends new data found to Telegram chat, to serve as notification.
- Repeats this process every 24h to update the data.
pip install -r requirements.txtCreate .env
HASDATA_API_KEY=your_api_key_here
LLM_KEY=your_api_key_here
LLM_SITE=optional_if_you_use_aggregator
BOT_TOKEN=telegram_bot_token
BOT_CHAT_ID=telegram_chat_idRun the batch example:
python src/main.pyRead Input from Settings folder
|
v
Scrape all brand mentions
|
v
Inference insights with AI
|
v
Save results in output/
|
v
Sends updates to Telegram
|
v
Repeats every 24 hours
extract-emails-from-google-search/
|-- assets/
|-- banner.png
|-- youtube-preview.png
|-- output/
|-- data/
|-- Brand_all_sources.csv
|-- Brand_competitors.csv
|-- Brand_facebook.csv
|-- Brand_instagram.csv
|-- Brand_negative.csv
|-- Brand_reddit.csv
|-- Brand_reviews.csv
|-- Brand_tiktok.csv
|-- Brand_x.csv
|-- img/
|-- Brand_chart.png
|-- settings/
|-- target_brand_description.txt
|-- target_brand_name.txt
|-- target_domain.txt
|-- src/
|-- __init__.py
|-- api.py
|-- llm.py
|-- main.py
|-- telegram_bot.py
|-- utils.py
|-- visualization.py
|-- .env
|-- .gitignore
|-- LICENSE
|-- README.md
|-- requirements.txt
- Python 3.10+
- A HasData API key
- LLM API key
- LLM SITE (optional)
- Telegram BOT ID (optional)
- Telegram CHAT ID (optional)
Install dependencies:
pip install -r requirements.txtCreate .env in the project root,
HASDATA_API_KEY=your_api_key_here
LLM_KEY=your_api_key_here
LLM_SITE=optional_if_you_use_aggregator
BOT_TOKEN=telegram_bot_token
BOT_CHAT_ID=telegram_chat_idThe scripts load this variable automatically with python-dotenv.
- Results depend on what Google snippets expose at request time.
- This approach only finds mentions that appear publicly in search results.
- Google tends to not give the same results for the same search query everytime.
- API usage depends on your HasData account and quota.
- LLM might not be 100% consistent
This project is meant to be extra material for a YouTube tutorial, and for anyone to copy change the settings and use it for themselves.
- PR research
- Market research
- Tutorial material for building a brand monitoring tool
- Business performance tracking
This project is licensed under the MIT License. See LICENSE.

