From 00000d9b0fa4ef23f929c1e55b987857c25d6e5c Mon Sep 17 00:00:00 2001 From: doms9 <96013514+doms9@users.noreply.github.com> Date: Wed, 10 Dec 2025 14:58:27 -0500 Subject: [PATCH] e --- M3U8/scrapers/streamfree.py | 10 +++++++--- M3U8/scrapers/utils/webwork.py | 20 ++++++++++++++++++++ 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/M3U8/scrapers/streamfree.py b/M3U8/scrapers/streamfree.py index fba3107..e8fecd2 100644 --- a/M3U8/scrapers/streamfree.py +++ b/M3U8/scrapers/streamfree.py @@ -1,8 +1,8 @@ -from urllib.parse import quote, urljoin +from urllib.parse import urljoin import httpx -from .utils import Cache, Time, get_logger, leagues +from .utils import Cache, Time, get_logger, leagues, network log = get_logger(__name__) @@ -62,7 +62,11 @@ async def get_events(client: httpx.AsyncClient) -> dict[str, dict[str, str | flo tvg_id, pic = leagues.get_tvg_info(sport, name) events[key] = { - "url": f"https://stream.nvrmind.xyz/strmfr/{stream_key}720p/index.m3u8?stream_name={quote(name)}", + "url": network.build_proxy_url( + tag=TAG, + path=f"{stream_key}720p/index.m3u8", + query={"stream_name": name}, + ), "logo": logo or pic, "base": BASE_URL, "timestamp": now, diff --git a/M3U8/scrapers/utils/webwork.py b/M3U8/scrapers/utils/webwork.py index 4199849..063faa9 100644 --- a/M3U8/scrapers/utils/webwork.py +++ b/M3U8/scrapers/utils/webwork.py @@ -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)