e
This commit is contained in:
parent
a7042a4560
commit
00000d91bb
2 changed files with 16 additions and 10 deletions
|
|
@ -19,6 +19,12 @@ BASE_URL = "https://streambtw.com"
|
|||
TAG = "STRMBTW"
|
||||
|
||||
|
||||
def fix_league(s: str) -> str:
|
||||
pattern = re.compile(r"^\w*-\w*", re.IGNORECASE)
|
||||
|
||||
return " ".join(s.split("-")) if pattern.search(s) else s
|
||||
|
||||
|
||||
async def process_event(
|
||||
client: httpx.AsyncClient,
|
||||
url: str,
|
||||
|
|
@ -62,13 +68,13 @@ async def get_events(client: httpx.AsyncClient) -> list[dict[str, str]]:
|
|||
if not (href := link.attrs.get("href")):
|
||||
continue
|
||||
|
||||
sport = card.css_first("h5.card-title").text(strip=True)
|
||||
league = card.css_first("h5.card-title").text(strip=True)
|
||||
|
||||
name = card.css_first("p.card-text").text(strip=True)
|
||||
|
||||
events.append(
|
||||
{
|
||||
"sport": sport,
|
||||
"sport": fix_league(league),
|
||||
"event": name,
|
||||
"link": urljoin(BASE_URL, href),
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue