Skip to content

Web Scraping Telegram | [Text] [Content] [Message] [Reactions] [Replies] [Comments] [Channels] [Groups] [Chats]

Notifications You must be signed in to change notification settings

shapefuture/web-scraping-telegram

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

67 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Telegram Job Vacancy Monitor

This script monitors Telegram channels and groups for job vacancies, filters them by keywords, and saves the results to Google Sheets.

Features

  • Monitors specified Telegram channels and groups
  • Filters messages by job-related keywords
  • Saves job vacancies to Google Sheets
  • Runs automatically every hour
  • Includes error handling and logging
  • Prevents duplicate entries

Prerequisites

  • Python 3.7 or higher
  • Telegram API credentials (API_ID and API_HASH)
  • Google Sheets API credentials
  • Access to the Telegram channels/groups you want to monitor

Setup

  1. Install the required packages:
pip install -r requirements.txt
  1. Set up Telegram API credentials:

  2. Set up Google Sheets API:

    • Go to Google Cloud Console
    • Create a new project
    • Enable Google Sheets API
    • Create a service account and download the credentials JSON file
    • Rename it to google_credentials.json and place it in the project directory
    • Share your Google Sheet with the service account email
  3. Create a .env file with your credentials:

TELEGRAM_API_ID=your_api_id
TELEGRAM_API_HASH=your_api_hash
TELEGRAM_PHONE=your_phone_number
GOOGLE_SHEETS_ID=your_spreadsheet_id
  1. Configure the channels to monitor:
    • Open config.py
    • Add the channel/group usernames or IDs to the CHANNELS list
    • Optionally modify the KEYWORDS list to filter different terms

Usage

Run the script:

python telegram_job_monitor.py

The script will:

  • Connect to Telegram
  • Monitor the specified channels
  • Filter messages containing job-related keywords
  • Save matching messages to Google Sheets
  • Run every hour automatically

Google Sheets Format

The script saves the following information to Google Sheets:

  • Timestamp
  • Channel name
  • Message ID
  • Message text
  • Direct link to the message

Logging

The script creates a telegram_monitor.log file that contains:

  • Connection status
  • Successful saves
  • Errors and exceptions

Error Handling

The script includes comprehensive error handling for:

  • API connection issues
  • Message processing errors
  • Google Sheets API errors
  • Channel access problems

Contributing

Feel free to submit issues and enhancement requests!

About

Web Scraping Telegram | [Text] [Content] [Message] [Reactions] [Replies] [Comments] [Channels] [Groups] [Chats]

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 84.4%
  • Jupyter Notebook 15.6%