drunkdream / weread-exporter

将微信读书中的书籍导出成epub、pdf、mobi等格式
1.2k stars 185 forks source link

Browser closed unexpectedly报错是为什么? #51

Open jiangaq opened 11 months ago

jiangaq commented 11 months ago
[2023-10-28 13:58:07,233][INFO]Exporting book f8a32350813ab71e0g015d0c
[2023-10-28 13:58:07,418][INFO][WeReadWebPage] Launch url https://weread.qq.com/web/bookDetail/f8a32350813ab71e0g015d0c
Traceback (most recent call last):
  File "/usr/local/Cellar/python@3.9/3.9.18/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/local/Cellar/python@3.9/3.9.18/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/Users/maq/PyProject/weread-exporter/weread_exporter/__main__.py", line 147, in <module>
    main()
  File "/Users/maq/PyProject/weread-exporter/weread_exporter/__main__.py", line 143, in main
    loop.run_until_complete(async_main())
  File "/usr/local/Cellar/python@3.9/3.9.18/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/base_events.py", line 647, in run_until_complete
    return future.result()
  File "/Users/maq/PyProject/weread-exporter/weread_exporter/__main__.py", line 77, in async_main
    await page.launch(headless=args.headless, force_login=args.force_login)
  File "/Users/maq/PyProject/weread-exporter/weread_exporter/webpage.py", line 153, in launch
    self._browser = await pyppeteer.launch(
  File "/Users/maq/PyProject/weread-exporter/venv/lib/python3.9/site-packages/pyppeteer/launcher.py", line 307, in launch
    return await Launcher(options, **kwargs).launch()
  File "/Users/maq/PyProject/weread-exporter/venv/lib/python3.9/site-packages/pyppeteer/launcher.py", line 168, in launch
    self.browserWSEndpoint = get_ws_endpoint(self.url)
  File "/Users/maq/PyProject/weread-exporter/venv/lib/python3.9/site-packages/pyppeteer/launcher.py", line 227, in get_ws_endpoint
    raise BrowserError('Browser closed unexpectedly:\n')
pyppeteer.errors.BrowserError: Browser closed unexpectedly:
xyw19870905 commented 11 months ago

不知道为啥,最近我也很经常碰到这个问题,之前用的是正常的

drunkdream commented 11 months ago

浏览器打开正常吗

mmschzs commented 11 months ago

我也是这个错误 [2023-11-02 19:51:45,176][ERROR]connection unexpectedly closed [2023-11-02 19:51:45,176][ERROR]Task exception was never retrieved future: <Task finished name='Task-1583' coro=<Connection._async_send() done, defined at D:\ProgramData\anaconda3\Lib\site-packages\pyppeteer\connection.py:69> exception=InvalidStateError('invalid state')> Traceback (most recent call last): File "D:\ProgramData\anaconda3\Lib\site-packages\websockets\legacy\protocol.py", line 1314, in close_connection
await self.transfer_data_task File "D:\ProgramData\anaconda3\Lib\site-packages\websockets\legacy\protocol.py", line 979, in transfer_data
await asyncio.shield(self._put_message_waiter) asyncio.exceptions.CancelledError

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "D:\ProgramData\anaconda3\Lib\site-packages\pyppeteer\connection.py", line 73, in _async_send await self.connection.send(msg) File "D:\ProgramData\anaconda3\Lib\site-packages\websockets\legacy\protocol.py", line 635, in send await self.ensure_open() File "D:\ProgramData\anaconda3\Lib\site-packages\websockets\legacy\protocol.py", line 944, in ensure_open raise self.connection_closed_exc() websockets.exceptions.ConnectionClosedError: sent 1000 (OK); no close frame received

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "D:\ProgramData\anaconda3\Lib\site-packages\pyppeteer\connection.py", line 79, in _async_send await self.dispose() File "D:\ProgramData\anaconda3\Lib\site-packages\pyppeteer\connection.py", line 170, in dispose await self._on_close() File "D:\ProgramData\anaconda3\Lib\site-packages\pyppeteer\connection.py", line 151, in _on_close cb.set_exception(_rewriteError( asyncio.exceptions.InvalidStateError: invalid state [2023-11-02 19:52:12,762][WARNING]Load chapter failed, close browser and retry [2023-11-02 19:52:12,763][INFO]terminate chrome process... [2023-11-02 19:52:12,888][INFO][WeReadWebPage] Launch url https://weread.qq.com/web/bookDetail/9ba322407159fb2d9ba76de

mmschzs commented 11 months ago

浏览器打开正常吗

打开正常,前9章都下得了

drunkdream commented 10 months ago

这种情况应该会关掉浏览器后再次打开重试的,是关闭后没有再打开吗?