From d0af04506148d896d8d4a45e9c4d39160bc2b7e2 Mon Sep 17 00:00:00 2001 From: cluntop <85211716+cluntop@users.noreply.github.com> Date: Fri, 27 Feb 2026 02:19:32 +0800 Subject: [PATCH] Update Up --- py/sinparty.py | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/py/sinparty.py b/py/sinparty.py index b55889cb1..ac3ce3dd4 100644 --- a/py/sinparty.py +++ b/py/sinparty.py @@ -18,10 +18,14 @@ async def fetch_m3u8(session: aiohttp.ClientSession, name: str, link: str): match = re.search(r'(https?:[\\/]+[^"\'\s]+\.m3u8[^"\'\s]*)', text) if match: m3u8_url = match.group(1).replace('\\/', '/') + # 【可视化新增】:实时输出成功嗅探到底层流的数据 + print(f" [√ 流捕获] {name.ljust(15)} -> {m3u8_url}") return name, m3u8_url, link except Exception: pass + # 【可视化新增】:实时输出未命中底层流,降级处理的数据 + print(f" [- 未嗅探] {name.ljust(15)} -> 未发现直接 m3u8,保留原始跳转链接") return name, None, link async def main(): @@ -32,18 +36,20 @@ async def main(): browser = await p.chromium.launch(headless=True) page = await browser.new_page(ignore_https_errors=True) - # 【核心新增】:注入反爬虫绕过脚本,抹除自动化特征,欺骗防御蜘蛛的探测 + # 注入反爬虫绕过脚本,抹除自动化特征,欺骗防御蜘蛛的探测 await page.add_init_script("Object.defineProperty(navigator, 'webdriver', {get: () => undefined})") + print("\n[*] 已挂载 Stealth 反检测脚本,webdriver 特征已抹除。") page_num = 1 while True: - print(f"正在加载并抓取第 {page_num} 页数据...") + print(f"\n{'='*50}") + print(f"[*] 正在加载并抓取第 {page_num} 页数据... (URL: https://sinparty.com/?page={page_num})") # 动态改变 page=&& 参数 url = f"https://sinparty.com/?page={page_num}" # 移除不可靠的 networkidle,使用默认导航机制 await page.goto(url) - # 【核心新增】:强制屏蔽拦截遮罩,破坏防御弹窗,恢复“可操作、可活动、可点击”状态 + # 强制屏蔽拦截遮罩,破坏防御弹窗,恢复“可操作、可活动、可点击”状态 await page.add_style_tag(content=''' .app-modal__overlay, .modal-auth__inner { display: none !important; z-index: -9999 !important; } body, html { pointer-events: auto !important; overflow: auto !important; user-select: auto !important; } @@ -52,20 +58,23 @@ async def main(): await page.evaluate('''() => { document.querySelectorAll('.app-modal__overlay, .modal-auth__inner').forEach(el => el.remove()); }''') + print("[*] 防御拦截层 (.app-modal__overlay) 已被强制物理摧毁,DOM 可点击限制已解除。") # 定位目标:跳过 skeleton 骨架屏,直接锁定在线主播节点 try: # 显式等待真实数据的 CSS 节点渲染到 DOM 中(最长容忍 20 秒) # 统一