mirror of
https://github.com/doms9/iptv.git
synced 2026-04-21 19:46:59 +02:00
e
- edit scraping for ovogoal.py - misc edits.
This commit is contained in:
parent
6bd8aa9814
commit
00000d905b
4 changed files with 23 additions and 29 deletions
|
|
@ -76,7 +76,7 @@ async def get_events(cached_hrefs: set[str]) -> list[dict[str, str]]:
|
||||||
{
|
{
|
||||||
"sport": sport,
|
"sport": sport,
|
||||||
"event": clean_event.sub("", event_name),
|
"event": clean_event.sub("", event_name),
|
||||||
"link": urljoin(BASE_URL, href),
|
"link": urljoin(f"{html_data.url}", href),
|
||||||
"href": href,
|
"href": href,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import re
|
import re
|
||||||
from functools import partial
|
from functools import partial
|
||||||
|
from urllib.parse import urljoin
|
||||||
|
|
||||||
from selectolax.parser import HTMLParser
|
from selectolax.parser import HTMLParser
|
||||||
|
|
||||||
|
|
@ -16,10 +17,6 @@ CACHE_FILE = Cache(TAG, exp=28_800)
|
||||||
BASE_URL = "https://ovogoaal.com"
|
BASE_URL = "https://ovogoaal.com"
|
||||||
|
|
||||||
|
|
||||||
def fix_league(s: str) -> str:
|
|
||||||
return " ".join(x.capitalize() for x in s.split()) if len(s) > 5 else s.upper()
|
|
||||||
|
|
||||||
|
|
||||||
async def process_event(url: str, url_num: int) -> tuple[str | None, str | None]:
|
async def process_event(url: str, url_num: int) -> tuple[str | None, str | None]:
|
||||||
nones = None, None
|
nones = None, None
|
||||||
|
|
||||||
|
|
@ -64,23 +61,20 @@ async def get_events(cached_keys: list[str]) -> list[dict[str, str]]:
|
||||||
|
|
||||||
soup = HTMLParser(html_data.content)
|
soup = HTMLParser(html_data.content)
|
||||||
|
|
||||||
sport = None
|
sport = "Live Event"
|
||||||
|
|
||||||
for node in soup.css(".wrapper *"):
|
for card in soup.css(".main-content .stream-row"):
|
||||||
if (cls := node.attributes.get("class")) == "section-title":
|
if (not (watch_btn_elem := card.css_first(".watch-btn"))) or (
|
||||||
sport = fix_league(node.text(strip=True))
|
not (onclick := watch_btn_elem.attributes.get("onclick"))
|
||||||
|
):
|
||||||
if node.tag == "a" and cls == "match":
|
|
||||||
if not sport:
|
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if not (team_elems := node.css(".team")):
|
if not (event_name_elem := card.css_first(".stream-info")):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if not (href := node.attributes.get("href")):
|
href = onclick.split(".href=")[-1].replace("'", "")
|
||||||
continue
|
|
||||||
|
|
||||||
event_name = " vs ".join(team.text(strip=True) for team in team_elems)
|
event_name = event_name_elem.text(strip=True)
|
||||||
|
|
||||||
if f"[{sport}] {event_name} ({TAG})" in cached_keys:
|
if f"[{sport}] {event_name} ({TAG})" in cached_keys:
|
||||||
continue
|
continue
|
||||||
|
|
@ -89,7 +83,7 @@ async def get_events(cached_keys: list[str]) -> list[dict[str, str]]:
|
||||||
{
|
{
|
||||||
"sport": sport,
|
"sport": sport,
|
||||||
"event": event_name,
|
"event": event_name,
|
||||||
"link": href,
|
"link": urljoin(f"{html_data.url}", href),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -113,7 +113,7 @@ async def get_events(cached_keys: list[str]) -> list[dict[str, str]]:
|
||||||
{
|
{
|
||||||
"sport": sport,
|
"sport": sport,
|
||||||
"event": event_name,
|
"event": event_name,
|
||||||
"link": urljoin(BASE_URL, href),
|
"link": urljoin(f"{html_data.url}", href),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ async def get_events() -> list[dict[str, str]]:
|
||||||
{
|
{
|
||||||
"sport": sport,
|
"sport": sport,
|
||||||
"event": event_name,
|
"event": event_name,
|
||||||
"link": urljoin(BASE_URL, href),
|
"link": urljoin(f"{html_data.url}", href),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue