aktueller Entwicklungsstand
This commit is contained in:
parent
8b13f16086
commit
b58d4e6f9e
1 changed files with 0 additions and 42 deletions
42
Euro2SQL.py
42
Euro2SQL.py
|
|
@ -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 <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