mirror of
https://github.com/doms9/iptv.git
synced 2026-01-21 03:59:03 +01:00
e
This commit is contained in:
parent
4717102586
commit
00000d9b0f
2 changed files with 27 additions and 3 deletions
|
|
@ -5,6 +5,7 @@ import re
|
|||
from collections.abc import Awaitable, Callable
|
||||
from functools import partial
|
||||
from typing import TypeVar
|
||||
from urllib.parse import urlencode, urljoin
|
||||
|
||||
import httpx
|
||||
from playwright.async_api import Browser, BrowserContext, Playwright, Request
|
||||
|
|
@ -15,6 +16,8 @@ T = TypeVar("T")
|
|||
|
||||
|
||||
class Network:
|
||||
proxy_base = "https://stream.nvrmind.xyz"
|
||||
|
||||
UA = (
|
||||
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) "
|
||||
"AppleWebKit/537.36 (KHTML, like Gecko) "
|
||||
|
|
@ -31,6 +34,23 @@ class Network:
|
|||
|
||||
self._logger = get_logger("network")
|
||||
|
||||
@staticmethod
|
||||
def build_proxy_url(
|
||||
tag: str,
|
||||
path: str,
|
||||
query: dict | None = None,
|
||||
) -> str:
|
||||
|
||||
base = network.proxy_base
|
||||
|
||||
tag = tag.lower()
|
||||
|
||||
return (
|
||||
f"{urljoin(base, f'{tag}/{path}')}?{urlencode(query)}"
|
||||
if query
|
||||
else urljoin(base, f"{tag}/{path}")
|
||||
)
|
||||
|
||||
async def check_status(self, url: str) -> bool:
|
||||
try:
|
||||
r = await self.client.get(url)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue