alle 4 Ziehungen eingepflegt, SQL in alle Tabellen
This commit is contained in:
parent
f88cd698a4
commit
ae67ff31c2
1 changed files with 42 additions and 0 deletions
42
Euro2SQL.py
Normal file
42
Euro2SQL.py
Normal file
|
|
@ -0,0 +1,42 @@
|
||||||
|
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 <b>-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("<b>Gewinnzahlen</b> nicht gefunden.")
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue