Unterscheidung Mi/Sa
This commit is contained in:
parent
b493410612
commit
0034b58884
1 changed files with 31 additions and 2 deletions
33
lotto2py.py
33
lotto2py.py
|
|
@ -1,14 +1,34 @@
|
||||||
import requests
|
import requests
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
import re
|
import re
|
||||||
|
from datetime import datetime
|
||||||
|
import base64
|
||||||
|
|
||||||
|
wochentag = datetime.today().weekday()
|
||||||
|
|
||||||
|
if wochentag == 2:
|
||||||
|
a = "582"
|
||||||
|
elif wochentag == 5:
|
||||||
|
a = "581"
|
||||||
|
else:
|
||||||
|
quit()
|
||||||
|
|
||||||
|
telegram_chat_id = "322673713"
|
||||||
|
telegram_token ='680737840:AAEaa7Vxl_kZz_LWS1_S-lH6Eda7HXqu6Y4'
|
||||||
|
|
||||||
|
def notify_telegram(text):
|
||||||
|
params = {"parse_mode": "HTML", "chat_id": telegram_chat_id, "text": text}
|
||||||
|
url = f"https://api.telegram.org/bot{telegram_token}/sendMessage"
|
||||||
|
requests.post(url, params=params)
|
||||||
|
|
||||||
# Ziel-URL (ARD‑Teletext Mobilseite 581)
|
# Ziel-URL (ARD‑Teletext Mobilseite 581)
|
||||||
url = "https://www.ard-text.de/mobil/582"
|
url = "https://www.ard-text.de/mobil/" + str(a)
|
||||||
|
|
||||||
headers = {
|
headers = {
|
||||||
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"
|
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
response = requests.get(url, headers=headers)
|
response = requests.get(url, headers=headers)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
|
|
||||||
|
|
@ -22,7 +42,13 @@ lottozahlen = []
|
||||||
superzahl = None
|
superzahl = None
|
||||||
spiel77 = []
|
spiel77 = []
|
||||||
super6 = []
|
super6 = []
|
||||||
|
datum_woche = None
|
||||||
|
|
||||||
|
# Wochentext extrahieren (z. B. "28. Woche / 09.07.25")
|
||||||
|
for line in text.splitlines():
|
||||||
|
if "Woche" in line and "/" in line:
|
||||||
|
datum_woche = line.strip()
|
||||||
|
break
|
||||||
# Regex: Hauptzahlen finden (z. B. Zeile enthält "11 20 28 30 35 41")
|
# Regex: Hauptzahlen finden (z. B. Zeile enthält "11 20 28 30 35 41")
|
||||||
match_haupt = re.search(r"\s(\d{1,2}(?:\s+\d{1,2}){5})\s", text)
|
match_haupt = re.search(r"\s(\d{1,2}(?:\s+\d{1,2}){5})\s", text)
|
||||||
if match_haupt:
|
if match_haupt:
|
||||||
|
|
@ -45,7 +71,10 @@ if match_super6:
|
||||||
super6 = [int(n) for n in match_super6.group(1).split()]
|
super6 = [int(n) for n in match_super6.group(1).split()]
|
||||||
|
|
||||||
# Ausgabe
|
# Ausgabe
|
||||||
|
print("Datum / Woche:", datum_woche)
|
||||||
print("Gezogene Lottozahlen (6 aus 49):", lottozahlen)
|
print("Gezogene Lottozahlen (6 aus 49):", lottozahlen)
|
||||||
print("Superzahl:", superzahl)
|
print("Superzahl:", superzahl)
|
||||||
print("Spiel 77:", spiel77)
|
print("Spiel 77:", spiel77)
|
||||||
print("Super 6 :", super6)
|
print("Super 6 :", super6)
|
||||||
|
|
||||||
|
notify_telegram(str(datum_woche)+ str(lottozahlen))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue