A Python-based Telegram bot that scrapes movie and series updates from websites like UFlix.to and posts them to a designated Telegram channel or group. The bot uses Markdown for formatted messages, encourages community engagement, and integrates with a local SQLite database and image directory for data management.
project/
├── telegram_bot/
│ ├── bot.py # Main bot script
│ ├── config.py # Configuration and environment setup
│ ├── logger.py # Logging setup
│ ├── .env # Environment variables (not in version control)
│ └── logs/
│ └── bot.log # Log file
└── webScraping/
└── data/
├── database/
│ └── movies_series.db # SQLite database
└── images/
├── movies/ # Movie images
└── series/ # Series images
📦 GitHub: https://github.com/ngir0003/telegram_bot.git
To run this bot, ensure you have the following:
- Python: Version 3.8 or higher
- Dependencies:
python-dotenv
: For handling.env
filesrequests
: For making Telegram API callssqlite3
: Built-in Python module for database operations
- Telegram Bot: Created via BotFather with a valid bot token
- Telegram Channel/Group: The bot must be an admin in the target channel or group
- Database: A SQLite database (
movies_series.db
) with tables for movies and series - Images: Stored in
webScraping/data/images/
(subfolders:movies/
andseries/
)
git clone https://github.com/ngir0003/telegram_bot.git
cd telegram_bot
python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
Create a requirements.txt
file with the following content:
python-dotenv
requests
Then install the dependencies:
pip install -r requirements.txt
Create a .env
file in the telegram_bot/
directory with the following structure:
BOT_TOKEN=your_telegram_bot_token
CHANNEL_ID=@your_channel_id
TELEGRAM_GROUP_NIKI=your_telegram_group_url
TELEGRAM_CHANNEL_KINGPING=your_telegram_channel_url
WHATSAPP_GROUP=your_whatsapp_group_url
DATABASE_PATH=../webScraping/data/database/movies_series.db
⚠️ Important: Do not commit the.env
file to version control. Ensure it is listed in.gitignore
.
python bot.py
The bot will start scraping updates, storing data in the SQLite database, and posting to the specified Telegram channel or group.
The bot posts updates in the following Markdown format:
🔥 Get Ready for More Awesome Content! 🔥
💥 Love what you see? Don’t keep it to yourself! 💥
📣 Share our groups with friends and join a growing community of movie & series lovers! 🎬💬
👥 Let’s Talk Stories! Join the chat, share your reviews, and discover hidden gems with fellow fans! 🌟
👇 Connect with us now! 👇
➡️ Telegram Group
➡️ Telegram Channel
➡️ WhatsApp Group
The bot logs activities, errors, and status updates to telegram_bot/logs/bot.log
. Logs include timestamps for easier debugging and monitoring.
- Built using python-telegram-bot
- Inspired by the content style of UFlix.to
To complete your project setup, you may want to add:
.gitignore
:venv/ *.pyc __pycache__/ telegram_bot/.env telegram_bot/logs/ webScraping/data/database/ webScraping/data/images/
If you need assistance with generating other files like bot.py
, config.py
, logger.py
, or the Apache License 2.0 text for the LICENSE
file, please let me know!