Site parser (where authorization is required) in python with regular sending of notifications to a telegram bot based on selenium on windows 10/11
Install globally:
python>=3.13.2;
pip>=24.3.1;
Register PATH (if you did not do this when installing python globally) environment variable;
Install a virtual environment for further convenience of working with the code and to avoid cluttering the working machine with unnecessary packages:
python - m venv venv
venv \scripts \a ctivate
Install python dependencies:
pip install - r requirements .txt
You will need to add your data to the file: secrets.py, which should contain:
URL - a link to the site where the information will be parsed;
LOGIN_URL - a link to authorization;
USERNAME - login from the account;
PASSWORD - password from the account;
class_name_prs - the class by which the parser will search for the necessary data for output;
class_name_btn_auth - the class by which the parser will search for the button for authorization;
TOKEN - telegram token;
CHAT_ID - user id to which notification will be sent;
message_text - message to be sent in telegram PM.
Run the parser with the command:
Enter:
Start hour in 24-hour format;
End hour in 24-hour format;
Start minute in 24-hour format;
End minute in 24-hour format.
Wait for notification in PM.
creating a docker-image for subsequent successful download and deployment of a docker container
Парсер сайтов (где требуется авторизация) на python с регулярной отправкой уведомлений в бот-телеграм на основе selenium на windows 10/11
Установить глобально:
python>=3.13.2;
pip>=24.3.1;
Прописать PATH (если не сделали это при установки python глобально) переменную среды;
Установить виртуальное окружение для дальнейшего удобства рвботы с кодом и чтобы не засорять рабочую машину ненужными пакетами:
python - m venv venv
venv \scripts \a ctivate
Установить зависимости python:
pip install - r requirements .txt
Вам понадобится добавить свои данные в файл: secrets.py, в котором должны быть:
URL - ссылка на сайт, где будет парситься информация;
LOGIN_URL- ссылка на авторизацию;
USERNAME - логин от учетной записи;
PASSWORD - пароль от учетной записи;
class_name_prs - класс по которому парсер будет искать нужную для вывода данных;
class_name_btn_auth - класс по которому парсер будет искать кнопку для авторизации;
TOKEN - токен телеграма;
CHAT_ID - id пользователя, которому будет приходить уведомление;
message_text - сообщение которое будет приходить в л.с. телеграма.
Запустить парсер командой:
Ввести:
Начальный час в формате 24-х часов;
Конечный час в формате 24-х часов;
Начальную минуту в формате 24-х часов;
Конечную минуту в формате 24-х часов.
Ожидать уведомления в л.с.
создание docker-image для последующей успешной загрузки и развертывания docker контейнера