e
This commit is contained in:
parent
bef684c5db
commit
00000d91f8
4 changed files with 779 additions and 776 deletions
|
|
@ -36,21 +36,18 @@ async def scrape(client: httpx.AsyncClient) -> None:
|
|||
for i, line in enumerate(data := await fetch_m3u8(client)):
|
||||
if line.startswith("#EXTINF"):
|
||||
tvg_id_match = re.search(r'tvg-id="([^"]*)"', line)
|
||||
tv_name_match = re.search(r'tvg-name="([^"]*)"', line)
|
||||
tvg_name_match = re.search(r'tvg-name="([^"]*)"', line)
|
||||
group_title_match = re.search(r'group-title="([^"]*)"', line)
|
||||
|
||||
tvg_id = tvg_id_match[1] if tvg_id_match else None
|
||||
tv_name = tv_name_match[1] if tv_name_match else None
|
||||
sport = group_title_match[1].upper().strip() if group_title_match else None
|
||||
tvg = tvg_id_match[1] if tvg_id_match else None
|
||||
|
||||
if tvg_id == "":
|
||||
url = data[i + 1]
|
||||
if not tvg and (url := data[i + 1]).endswith("/hd"):
|
||||
if tvg_name := tvg_name_match[1]:
|
||||
sport = group_title_match[1].upper().strip()
|
||||
|
||||
if tv_name:
|
||||
tv_name = "(".join(tv_name.split("(")[:-1]).strip()
|
||||
event = "(".join(tvg_name.split("(")[:-1]).strip()
|
||||
|
||||
if url.endswith("/hd"):
|
||||
key = f"[{sport}] {tv_name} (TVP)"
|
||||
key = f"[{sport}] {event} (TVP)"
|
||||
|
||||
channel = url.split("/")[-2]
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue