- edit livetvsx.py scraping
This commit is contained in:
doms9 2026-03-02 20:02:26 -05:00
parent b896a22a29
commit 00000d9ab1
5 changed files with 55 additions and 26 deletions

View file

@ -19,12 +19,17 @@ BASE_URL = "https://pixelsport.tv"
async def get_api_data(page: Page) -> dict[str, list[dict, str, str]]:
try:
await page.goto(
resp = await page.goto(
url := urljoin(BASE_URL, "backend/livetv/events"),
wait_until="domcontentloaded",
timeout=6_000,
)
if resp.status != 200:
log.warning(f"{url} status code: {resp.status}")
return {}
raw_json = await page.locator("pre").inner_text(timeout=5_000)
except Exception as e:
log.error(f'Failed to fetch "{url}": {e}')