Skip to content

HasData/social-listening-tool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python Requests dotenv

AI Social Listening Tool

HasData_bannner

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.

Watch the video

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.

Quick Start

pip install -r requirements.txt

Create .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_id

Run the batch example:

python src/main.py

Workflow

Read 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

Project Structure

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

Requirements

  • 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.txt

Configuration

Create .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_id

The scripts load this variable automatically with python-dotenv.

Scripts

Run

src/main.py

Notes

  • 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

Why This Repo Exists

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.

Use Cases

  • PR research
  • Market research
  • Tutorial material for building a brand monitoring tool
  • Business performance tracking

License

This project is licensed under the MIT License. See LICENSE.

About

AI-powered social listening tool that tracks brand mentions across Google, Instagram, Facebook, TikTok, Reddit, and X (Twitter). Uses HasData SERP API + LLM inference to extract structured insights, generate charts, export CSV reports, and send Telegram notifications on a 24-hour automated cycle.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages