aktueller Entwicklungsstand

This commit is contained in:
hubobel 2025-07-24 16:46:10 +02:00
parent b58d4e6f9e
commit 09197b4389

View file

@ -44,10 +44,12 @@ def notify_telegram(text):
requests.post(url, params=params) requests.post(url, params=params)
def Euro(): def Euro():
url = 'https://www.ard-text.de/mobil/583' 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() response.raise_for_status()
soup = BeautifulSoup(response.text, "html.parser") soup = BeautifulSoup(response.text, "html.parser")
ziffern = []
ZahlenEuro = { ZahlenEuro = {
'Freitag': {'Datum': '', 'Z1': '', 'Z2': '', 'Z3': '', 'Z4': '', 'Z5': '', 'Eurozahl1': '', 'Eurozahl2': ''}, 'Freitag': {'Datum': '', 'Z1': '', 'Z2': '', 'Z3': '', 'Z4': '', 'Z5': '', 'Eurozahl1': '', 'Eurozahl2': ''},
'Dienstag': {'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 ZahlenEuro[Tag]['Datum'] = b
tabelle = b.find_parent().find_next_sibling("table") tabelle = b.find_parent().find_next_sibling("table")
a = 1 a = 1
print(b) #print(b)
for n in tabelle.find_all("td"): for n in tabelle.find_all("td"):
c = (n.get_text(strip=True)) c = (n.get_text(strip=True))
b = 'Z' + str(a) b = 'Z' + str(a)
ZahlenEuro[Tag][b] = int(c) ZahlenEuro[Tag][b] = int(c)
a = a + 1 a = a + 1
eurozahlen_tags = soup.find_all("b", string=lambda s: s and "eurozahlen" in s.lower()) eurozahlen_tags = soup.find_all("b", string=lambda s: s and "eurozahlen" in s.lower())
aa = 1 aa = 1
if len(eurozahlen_tags) >= 2: if len(eurozahlen_tags) >= 2:
eurozahlen_table_2 = eurozahlen_tags[1].find_next("table") eurozahlen_table_2 = eurozahlen_tags[1].find_next("table")
@ -205,7 +206,7 @@ def SQLdienstag(data):
resp = cursor.execute(sql_q) resp = cursor.execute(sql_q)
if resp == 0: if resp == 0:
cursor.execute(sql) cursor.execute(sql)
print(resp) #print(resp)
connection.commit() connection.commit()
cursor.close() cursor.close()
connection.close() connection.close()
@ -268,7 +269,7 @@ telegram_chat_id = passw['Telegram']['Chat_ID']
telegram_token = passw['Telegram']['TOKEN'] telegram_token = passw['Telegram']['TOKEN']
wochentag = datetime.today().weekday() wochentag = datetime.today().weekday()
#wochentag = 2 wochentag = 1
if wochentag == 2: if wochentag == 2:
Zahl = Normalziehung(582) Zahl = Normalziehung(582)