From 803e19111cd65ab310da57c5cc65588d25185db5 Mon Sep 17 00:00:00 2001 From: Miracle778 Date: Sun, 31 May 2026 21:35:11 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=9F=A5=E4=B9=8E=20s?= =?UTF-8?q?pecified=5Fid=20=E5=92=8C=E5=B7=B2=E6=9C=89=20Chrome=20CDP=20?= =?UTF-8?q?=E8=BF=9E=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmd_arg/arg.py | 2 ++ tools/cdp_browser.py | 7 +++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/cmd_arg/arg.py b/cmd_arg/arg.py index 074dd13..20d1d39 100644 --- a/cmd_arg/arg.py +++ b/cmd_arg/arg.py @@ -382,6 +382,8 @@ async def parse_cmd(argv: Optional[Sequence[str]] = None): config.TIEBA_SPECIFIED_ID_LIST = [ _normalize_tieba_note_id(item) for item in specified_id_list ] + elif platform == PlatformEnum.ZHIHU: + config.ZHIHU_SPECIFIED_ID_LIST = specified_id_list if creator_id_list: if platform == PlatformEnum.XHS: diff --git a/tools/cdp_browser.py b/tools/cdp_browser.py index b674f51..c6d76b9 100644 --- a/tools/cdp_browser.py +++ b/tools/cdp_browser.py @@ -316,10 +316,9 @@ class CDPBrowserManager: """ try: if config.CDP_CONNECT_EXISTING: - # For existing browser (e.g. chrome://inspect/#remote-debugging), - # Chrome exposes a WebSocket at /devtools/browser and may show a confirmation - # dialog to the user. Use ws:// with a longer timeout to wait for user confirmation. - ws_url = f"ws://localhost:{self.debug_port}/devtools/browser" + # Existing Chrome exposes the browser websocket URL from /json/version. + # Newer Chrome versions return a UUID path instead of plain /devtools/browser. + ws_url = await self._get_browser_websocket_url(self.debug_port) utils.logger.info(f"[CDPBrowserManager] Connecting to existing browser via CDP: {ws_url}") utils.logger.info( "[CDPBrowserManager] Please check your browser for a confirmation dialog and accept it"