e
This commit is contained in:
parent
b3d3df3d5b
commit
00000d9ee7
2 changed files with 7 additions and 5 deletions
|
|
@ -142,7 +142,7 @@ async def scrape(client: httpx.AsyncClient) -> None:
|
||||||
tvg_id, pic = leagues.get_tvg_info(sport, event)
|
tvg_id, pic = leagues.get_tvg_info(sport, event)
|
||||||
|
|
||||||
entry = {
|
entry = {
|
||||||
"url": url,
|
"url": url.replace("540p", "720p"),
|
||||||
"logo": logo or pic,
|
"logo": logo or pic,
|
||||||
"base": "",
|
"base": "",
|
||||||
"timestamp": ts,
|
"timestamp": ts,
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,17 @@
|
||||||
import asyncio
|
import asyncio
|
||||||
import logging
|
import logging
|
||||||
import re
|
import re
|
||||||
from collections.abc import Callable
|
from collections.abc import Awaitable, Callable
|
||||||
from functools import partial
|
from functools import partial
|
||||||
from typing import Any
|
from typing import TypeVar
|
||||||
|
|
||||||
import httpx
|
import httpx
|
||||||
from playwright.async_api import Browser, BrowserContext, Playwright, Request
|
from playwright.async_api import Browser, BrowserContext, Playwright, Request
|
||||||
|
|
||||||
from .logger import get_logger
|
from .logger import get_logger
|
||||||
|
|
||||||
|
T = TypeVar("T")
|
||||||
|
|
||||||
|
|
||||||
class Network:
|
class Network:
|
||||||
UA = (
|
UA = (
|
||||||
|
|
@ -49,11 +51,11 @@ class Network:
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
async def safe_process(
|
async def safe_process(
|
||||||
fn: Callable,
|
fn: Callable[[], Awaitable[T]],
|
||||||
url_num: int,
|
url_num: int,
|
||||||
timeout: int | float = 15,
|
timeout: int | float = 15,
|
||||||
log: logging.Logger | None = None,
|
log: logging.Logger | None = None,
|
||||||
) -> Any | None:
|
) -> T | None:
|
||||||
|
|
||||||
if not log:
|
if not log:
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue