mirror of
https://github.com/NanmiCoder/MediaCrawler.git
synced 2026-07-23 21:00:33 +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 = [
|
config.TIEBA_SPECIFIED_ID_LIST = [
|
||||||
_normalize_tieba_note_id(item) for item in 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 creator_id_list:
|
||||||
if platform == PlatformEnum.XHS:
|
if platform == PlatformEnum.XHS:
|
||||||
|
|||||||
@@ -316,10 +316,9 @@ class CDPBrowserManager:
|
|||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
if config.CDP_CONNECT_EXISTING:
|
if config.CDP_CONNECT_EXISTING:
|
||||||
# For existing browser (e.g. chrome://inspect/#remote-debugging),
|
# Existing Chrome exposes the browser websocket URL from /json/version.
|
||||||
# Chrome exposes a WebSocket at /devtools/browser and may show a confirmation
|
# Newer Chrome versions return a UUID path instead of plain /devtools/browser.
|
||||||
# dialog to the user. Use ws:// with a longer timeout to wait for user confirmation.
|
ws_url = await self._get_browser_websocket_url(self.debug_port)
|
||||||
ws_url = f"ws://localhost:{self.debug_port}/devtools/browser"
|
|
||||||
utils.logger.info(f"[CDPBrowserManager] Connecting to existing browser via CDP: {ws_url}")
|
utils.logger.info(f"[CDPBrowserManager] Connecting to existing browser via CDP: {ws_url}")
|
||||||
utils.logger.info(
|
utils.logger.info(
|
||||||
"[CDPBrowserManager] Please check your browser for a confirmation dialog and accept it"
|
"[CDPBrowserManager] Please check your browser for a confirmation dialog and accept it"
|
||||||
|
|||||||
Reference in New Issue
Block a user