Compare commits

..

No commits in common. "b269e01bbffbd4a4d065a2d283cdd2e44f70df25" and "bf78690baafa3440d9864600942bdde9079523e1" have entirely different histories.

View file

@ -44,12 +44,10 @@ 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'
headers = { response = requests.get(url)
"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': ''}}
@ -76,13 +74,14 @@ 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")
@ -206,7 +205,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()
@ -269,7 +268,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 = 1 #wochentag = 2
if wochentag == 2: if wochentag == 2:
Zahl = Normalziehung(582) Zahl = Normalziehung(582)