mirror of
https://github.com/doms9/iptv.git
synced 2026-03-07 11:18:25 +01:00
e
fix livetvsx.py scraping edit health check script
This commit is contained in:
parent
53686dcc16
commit
00000d968d
3 changed files with 15 additions and 10 deletions
|
|
@ -10,12 +10,12 @@ log = get_logger(__name__)
|
|||
|
||||
urls: dict[str, dict[str, str | float]] = {}
|
||||
|
||||
TAG = "LTVSX"
|
||||
|
||||
XML_CACHE = Cache(f"{TAG}-xml", exp=28_000)
|
||||
TAG = "LIVETVSX"
|
||||
|
||||
CACHE_FILE = Cache(TAG, exp=10_800)
|
||||
|
||||
XML_CACHE = Cache(f"{TAG}-xml", exp=28_000)
|
||||
|
||||
BASE_URL = "https://cdn.livetv861.me/rss/upcoming_en.xml"
|
||||
|
||||
VALID_SPORTS = {"NBA", "NHL", "NFL", "NCAA", "MLB"}
|
||||
|
|
@ -193,7 +193,7 @@ async def scrape(browser: Browser) -> None:
|
|||
log.info(f"Processing {len(events)} new URL(s)")
|
||||
|
||||
if events:
|
||||
async with network.event_context(browser) as context:
|
||||
async with network.event_context(browser, ignore_https=True) as context:
|
||||
for i, ev in enumerate(events, start=1):
|
||||
async with network.event_page(context) as page:
|
||||
handler = partial(
|
||||
|
|
|
|||
|
|
@ -129,12 +129,14 @@ class Network:
|
|||
async def event_context(
|
||||
browser: Browser,
|
||||
stealth: bool = True,
|
||||
ignore_https: bool = False,
|
||||
) -> AsyncGenerator[BrowserContext, None]:
|
||||
context: BrowserContext | None = None
|
||||
|
||||
try:
|
||||
context = await browser.new_context(
|
||||
user_agent=Network.UA if stealth else None,
|
||||
ignore_https_errors=ignore_https,
|
||||
viewport={"width": 1366, "height": 768},
|
||||
device_scale_factor=1,
|
||||
locale="en-US",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue