From b58d4e6f9e74909c2c5568527943a2fc654696b0 Mon Sep 17 00:00:00 2001 From: hubobel Date: Thu, 24 Jul 2025 16:33:32 +0200 Subject: [PATCH 1/2] aktueller Entwicklungsstand --- Euro2SQL.py | 42 ------------------------------------------ 1 file changed, 42 deletions(-) delete mode 100644 Euro2SQL.py diff --git a/Euro2SQL.py b/Euro2SQL.py deleted file mode 100644 index 195af92..0000000 --- a/Euro2SQL.py +++ /dev/null @@ -1,42 +0,0 @@ -import requests -from bs4 import BeautifulSoup - -# URL der Zielseite (Eurojackpot bei ARD-Text) -url = "https://lotto.gmx.de/eurojackpot/zahlen-quoten" - -# HTTP-Request senden -response = requests.get(url) -response.raise_for_status() # Fehlerprüfung - -# HTML mit BeautifulSoup parsen -soup = BeautifulSoup(response.text, "html.parser") - -# Formatierten HTML-Code ausgeben -formatted_html = soup.prettify() - -# Ausgabe in der Konsole -#print(formatted_html) - -url = "https://lotto.gmx.de/eurojackpot/zahlen-quoten" -response = requests.get(url) -soup = BeautifulSoup(response.text, "html.parser") - -# Finde den ersten div mit einer bestimmten Klasse -html_code = soup.find("div", class_="std") -print(html_code) -# HTML parsen -soup = BeautifulSoup(response.text, "html.parser") - -# Robust: finde -Tag mit "Gewinnzahlen" (normalisiert auf Whitespace!) -b_tag = soup.find("b", string=lambda s: s and "gewinnzahlen" in s.lower()) - -if b_tag: - table = b_tag.find_parent().find_next_sibling("table") - if table: - gewinnzahlen = [int(td.get_text(strip=True)) for td in table.find_all("td")] - print("Gewinnzahlen:", gewinnzahlen) - else: - print("Tabelle nicht gefunden.") -else: - print("Gewinnzahlen nicht gefunden.") - From 09197b43893a2daf359b26573bb6e3a0479bc8bb Mon Sep 17 00:00:00 2001 From: hubobel Date: Thu, 24 Jul 2025 16:46:10 +0200 Subject: [PATCH 2/2] aktueller Entwicklungsstand --- lotto2py.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lotto2py.py b/lotto2py.py index e71b610..61bbca4 100644 --- a/lotto2py.py +++ b/lotto2py.py @@ -44,10 +44,12 @@ def notify_telegram(text): requests.post(url, params=params) def Euro(): url = 'https://www.ard-text.de/mobil/583' - response = requests.get(url) + 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" + } + response = requests.get(url, headers=headers) response.raise_for_status() soup = BeautifulSoup(response.text, "html.parser") - ziffern = [] ZahlenEuro = { 'Freitag': {'Datum': '', 'Z1': '', 'Z2': '', 'Z3': '', 'Z4': '', 'Z5': '', 'Eurozahl1': '', 'Eurozahl2': ''}, 'Dienstag': {'Datum': '', 'Z1': '', 'Z2': '', 'Z3': '', 'Z4': '', 'Z5': '', 'Eurozahl1': '', 'Eurozahl2': ''}} @@ -74,14 +76,13 @@ def Euro(): ZahlenEuro[Tag]['Datum'] = b tabelle = b.find_parent().find_next_sibling("table") a = 1 - print(b) + #print(b) for n in tabelle.find_all("td"): c = (n.get_text(strip=True)) b = 'Z' + str(a) ZahlenEuro[Tag][b] = int(c) a = a + 1 eurozahlen_tags = soup.find_all("b", string=lambda s: s and "eurozahlen" in s.lower()) - aa = 1 if len(eurozahlen_tags) >= 2: eurozahlen_table_2 = eurozahlen_tags[1].find_next("table") @@ -205,7 +206,7 @@ def SQLdienstag(data): resp = cursor.execute(sql_q) if resp == 0: cursor.execute(sql) - print(resp) + #print(resp) connection.commit() cursor.close() connection.close() @@ -268,7 +269,7 @@ telegram_chat_id = passw['Telegram']['Chat_ID'] telegram_token = passw['Telegram']['TOKEN'] wochentag = datetime.today().weekday() -#wochentag = 2 +wochentag = 1 if wochentag == 2: Zahl = Normalziehung(582)