This script monitors a specified website for the presence of a particular text and sends a desktop notification when the text is found. It uses random user-agent headers to bypass security checks on the website.
- Periodically checks a website for a specific text.
- Uses random user-agent headers from a file (
useragents.txt
) to avoid detection by security mechanisms. - Sends desktop notifications when the specified text is found.
- Includes error handling and logging.
- Sends Email once a keyword found in the web page
- Use Gmail app password for credentials
- Guide: https://support.google.com/mail/answer/185833?hl=en
- Python 3.x
requests
librarybs4
libraryplyer
library
-
Install the required Python packages:
pip install requests beautifulsoup4 plyer
-
Create a
useragents.txt
file in the same directory as your script. This file should contain different user-agent strings, one per line. -
Download or clone the script.
-
Modify the
url
andsearch_text
variables in the script to your desired values.url = "https://service2.diplo.de/rktermin/extern/appointment_showForm.do?locationCode=isla&realmId=108&categoryId=1600" search_text = "language course"
-
Run the script:
python3 your_script_name.py
Replace your_script_name.py
with the name of your Python file.
The script performs the following steps:
- Reads a random user-agent header from
useragents.txt
. - Sends an HTTP GET request to the specified URL using the random user-agent header.
- Parses the HTML content of the page and searches for the specified text.
- Sends emails to all receipient, once the keyword found on the web-page.
- Sends a desktop notification if the text is found.
- Repeats the check every 30 seconds.
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36 Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36 Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:89.0) Gecko/20100101 Firefox/89.0