The KTU Bot is a Python-based bot that scrapes data from the Kerala Technological University (KTU) official website to provide you with the latest announcements. It retrieves information from the KTU Announcements page and delivers updates to your channel or chat.
Live Working Demo on KTU Announcements
- Scrapes the KTU Announcements page for the latest updates.
- Sends notifications to your Telegram chat.
- Easy setup and configuration using environment variables.
-
Clone this GitHub repository to your local machine:
git clone https://github.com/10cyrilc/ktu-bot.git
-
Change to the project directory:
cd ktu-bot
-
Create a virtual environment to install the dependencies:
python3 -m venv venv
-
Activate the virtual environment:
-
For macOS/Linux:
source venv/bin/activate
-
For Windows:
venv\Scripts\activate
-
-
Install the required dependencies:
pip install -r requirements.txt
-
Rename the
.env.example
file to.env
. -
Open the
.env
file and set the following variables:MONGO_URI
: The connection URI for your MongoDB database.SESSION_NAME
: A unique identifier for your bot session.BOT_ID
: The ID of your Telegram bot from @Botfather.CHAT_ID
: The identifier for the Telegram chat where you want to receive notifications.
-
Setup a cron job to run the bot script every 5 minutes:
-
Open your crontab file:
crontab -e
-
Add the following line to the file:
*/5 * * * * /path/to/python3 /path/to/ktu-announcement-bot/main.py
Replace
/path/to/python3
with the absolute path to your Python 3 executable, and replace/path/to/ktu-announcement-bot/main.py
with the absolute path to themain.py
script of the bot. -
Save the crontab file.
-
The KTU Bot will now run as a scheduled cron job, scraping the KTU Announcements page and sending notifications to your specified Telegram chat every 5 minutes.
Contributions to the KTU Bot are welcome! If you encounter any issues or have suggestions for improvements, please open an issue on the GitHub repository. You can also submit pull requests with your proposed changes.
The KTU Bot is licensed under the MIT License.
Special thanks to the developers of the libraries and frameworks used in this project:
- Beautiful Soup: Used for web scraping.
- python-telegram-bot: Used for Telegram bot integration.
- pymongo: Used for MongoDB integration.