mirror of
https://github.com/doms9/iptv.git
synced 2026-04-21 19:46:59 +02:00
e
This commit is contained in:
parent
75cc3e4bb5
commit
00000d917d
1 changed files with 21 additions and 23 deletions
|
|
@ -64,36 +64,34 @@ async def get_events(cached_keys: list[str]) -> list[dict[str, str]]:
|
||||||
|
|
||||||
soup = HTMLParser(html_data.content)
|
soup = HTMLParser(html_data.content)
|
||||||
|
|
||||||
for card in soup.css(".section-title"):
|
sport = None
|
||||||
sport = fix_league(card.text(strip=True))
|
|
||||||
|
|
||||||
node = card.next
|
for node in soup.css(".wrapper *"):
|
||||||
|
if (cls := node.attributes.get("class")) == "section-title":
|
||||||
|
sport = fix_league(node.text(strip=True))
|
||||||
|
|
||||||
while node:
|
if node.tag == "a" and cls == "match":
|
||||||
if node.attributes.get("class") == "section-title":
|
if not sport:
|
||||||
break
|
continue
|
||||||
|
|
||||||
elif node.tag == "a" and node.attributes.get("class") == "match":
|
if not (team_elems := node.css(".team")):
|
||||||
if not (team_elems := node.css(".team")):
|
continue
|
||||||
continue
|
|
||||||
|
|
||||||
if not (href := node.attributes.get("href")):
|
if not (href := node.attributes.get("href")):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
event_name = " vs ".join(team.text(strip=True) for team in team_elems)
|
event_name = " vs ".join(team.text(strip=True) for team in team_elems)
|
||||||
|
|
||||||
if f"[{sport}] {event_name} ({TAG})" in cached_keys:
|
if f"[{sport}] {event_name} ({TAG})" in cached_keys:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
events.append(
|
events.append(
|
||||||
{
|
{
|
||||||
"sport": sport,
|
"sport": sport,
|
||||||
"event": event_name,
|
"event": event_name,
|
||||||
"link": href,
|
"link": href,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
node = node.next
|
|
||||||
|
|
||||||
return events
|
return events
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue