mirror of
https://github.com/NanmiCoder/MediaCrawler.git
synced 2026-07-23 12:50:29 +08:00
fix: 修复知乎 specified_id 和已有 Chrome CDP 连接
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user