Initial
This commit is contained in:
parent
3f21b2bda6
commit
2186871a7f
60
nox-forum-watcher.v1.py
Normal file
60
nox-forum-watcher.v1.py
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
'''
|
||||||
|
Script Name: nox-forum-watcher.v1.py
|
||||||
|
Beschreibung: Richtet ein SMB Share auf dem Client/Server ein
|
||||||
|
Aufruf: python3 nox-forum-watcher.v1.py
|
||||||
|
Autor: Patrick Asmus
|
||||||
|
Web: https://www.media-techport.de
|
||||||
|
Git-Reposit.: https://git.media-techport.de/scriptos/nox-forum-watcher.git
|
||||||
|
Version: 1.0
|
||||||
|
Datum: 21.03.2024
|
||||||
|
Modifikation: Initial
|
||||||
|
'''
|
||||||
|
|
||||||
|
import requests
|
||||||
|
from bs4 import BeautifulSoup
|
||||||
|
import smtplib
|
||||||
|
from email.mime.text import MIMEText
|
||||||
|
import time
|
||||||
|
|
||||||
|
# E-Mail-Einstellungen
|
||||||
|
smtp_server = 'smtp.media-techport.int'
|
||||||
|
smtp_port = 25
|
||||||
|
absender_email = 'noreply@media-techport.de'
|
||||||
|
empfaenger_email = 'system@media-techport.de'
|
||||||
|
|
||||||
|
# URL des Forums
|
||||||
|
url = "https://forum.nox.to/index.php?thread/133929-gutschein-angebote/"
|
||||||
|
topic= "Forum NOX.TO | Gutschein Angebote"
|
||||||
|
|
||||||
|
# Letzter bekannter Beitrag
|
||||||
|
letzter_beitrag = ""
|
||||||
|
|
||||||
|
while True:
|
||||||
|
response = requests.get(url)
|
||||||
|
soup = BeautifulSoup(response.text, 'html.parser')
|
||||||
|
|
||||||
|
# Alle Beiträge gemäß des festgelegten Musters auswählen
|
||||||
|
beitraege = soup.select('div:nth-child(3) > header:nth-child(1) > ul:nth-child(2) > li:nth-child(1) > a:nth-child(1)')
|
||||||
|
|
||||||
|
# Überprüfe, ob neue Beiträge vorhanden sind
|
||||||
|
if beitraege and beitraege[-1].text != letzter_beitrag:
|
||||||
|
neuer_beitrag = beitraege[-1].text
|
||||||
|
letzter_beitrag = neuer_beitrag
|
||||||
|
|
||||||
|
# E-Mail-Inhalte
|
||||||
|
subject = "Neuer Beitrag im Forum"
|
||||||
|
body = f"Es gibt einen neuen Forenbeitrag im Thema: {topic}"
|
||||||
|
|
||||||
|
# E-Mail senden
|
||||||
|
msg = MIMEText(body)
|
||||||
|
msg['Subject'] = subject
|
||||||
|
msg['From'] = absender_email
|
||||||
|
msg['To'] = empfaenger_email
|
||||||
|
|
||||||
|
# Verbindung zum SMTP-Server herstellen
|
||||||
|
server = smtplib.SMTP(smtp_server, smtp_port)
|
||||||
|
server.send_message(msg)
|
||||||
|
server.quit()
|
||||||
|
|
||||||
|
# Wartezeit zwischen den Überprüfungen
|
||||||
|
time.sleep(60) # 1 Minute
|
Loading…
Reference in New Issue
Block a user