drunkdream / weread-exporter

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

加载书籍内容超时 load selector timeout #104

Open moleoxa opened 1 month ago

moleoxa commented 1 month ago

安装完依赖后,运行提示没有 chrome,于是把 chrome 加入环境变量。

再次以 -- force-login 参数运行,成功拉起了 chrome,但是卡住在 about:blank 页,等待一段时间后会自动退出 chrome 并报错。

图片

C:\Users\Administrator>python -m weread_exporter -b adc32180813ab8786g014ba6 -o epub
Fontconfig error: Cannot load default config file: No such file: (null)
[2024-09-28 17:50:41,239][INFO]Exporting book adc32180813ab8786g014ba6
[2024-09-28 17:50:41,440][INFO][WeReadWebPage] Launch url https://weread.qq.com/web/bookDetail/adc32180813ab8786g014ba6
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "D:\User\Desktop\test\weread-exporter-main\weread_exporter\__main__.py", line 158, in <module>
    main()
  File "D:\User\Desktop\test\weread-exporter-main\weread_exporter\__main__.py", line 154, in main
    loop.run_until_complete(async_main())
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\asyncio\base_events.py", line 654, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "D:\User\Desktop\test\weread-exporter-main\weread_exporter\__main__.py", line 85, in async_main
    await page.launch(headless=args.headless, force_login=args.force_login)
  File "D:\User\Desktop\test\weread-exporter-main\weread_exporter\webpage.py", line 175, in launch
    self._browser = await pyppeteer.launch(
                    ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyppeteer\launcher.py", line 307, in launch
    return await Launcher(options, **kwargs).launch()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyppeteer\launcher.py", line 168, in launch
    self.browserWSEndpoint = get_ws_endpoint(self.url)
                             ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyppeteer\launcher.py", line 227, in get_ws_endpoint
    raise BrowserError('Browser closed unexpectedly:\n')
pyppeteer.errors.BrowserError: Browser closed unexpectedly:

[2024-09-28 17:51:11,699][INFO]terminate chrome process...
moleoxa commented 1 month ago

重头装了环境,这回成功加载了页面并获得了cookie,但是加载书籍内容阅读页面时失败超时了。

图片

D:\User\Desktop\test\weread-exporter>python -m weread_exporter -b adc32180813ab8786g014ba6 -o epub --force-login
Fontconfig error: Cannot load default config file: No such file: (null)
[2024-09-28 22:18:16,841][INFO]Exporting book adc32180813ab8786g014ba6
[2024-09-28 22:18:17,867][INFO][WeReadWebPage] Launch url https://weread.qq.com/web/bookDetail/adc32180813ab8786g014ba6
[2024-09-28 22:18:18,410][INFO]Browser listening on: ws://127.0.0.1:49783/devtools/browser/d14edf43-2640-41bb-b03b-1db5e5fbb560
[2024-09-28 22:18:27,130][INFO][WeReadWebPage] Waiting for login
[2024-09-28 22:18:37,137][INFO][WeReadWebPage] Waiting for login
[2024-09-28 22:18:47,145][INFO][WeReadWebPage] Login success
[2024-09-28 22:18:48,147][ERROR]Future exception was never retrieved
future: <Future finished exception=NetworkError('Protocol error Target.detachFromTarget: Target closed.')>
pyppeteer.errors.NetworkError: Protocol error Target.detachFromTarget: Target closed.
[2024-09-28 22:18:48,147][ERROR]Future exception was never retrieved
future: <Future finished exception=NetworkError('Protocol error (Target.sendMessageToTarget): No session with given id')>
pyppeteer.errors.NetworkError: Protocol error (Target.sendMessageToTarget): No session with given id
[2024-09-28 22:18:51,989][INFO][WeReadExporter] Check chapter 2/版权信息
[2024-09-28 22:18:51,989][INFO][WeReadExporter] File cache\adc32180813ab8786g014ba6\chapters\1-2.md not exist
[2024-09-28 22:18:51,989][INFO][WeReadWebPage] Go to chapter 2
[2024-09-28 22:18:52,008][INFO][WeReadWebPage] Fetch url https://weread.qq.com/web/reader/adc32180813ab8786g014ba6kc81322c012c81e728d9d180
[2024-09-28 22:18:53,270][INFO][WeReadWebPage] Fetch url https://midas.gtimg.cn/midas/minipay_v2/jsapi/cashier.js
[2024-09-28 22:18:53,271][INFO][WeReadWebPage] Fetch url https://cdn.weread.qq.com/web/wpa.js
[2024-09-28 22:18:53,271][INFO][WeReadWebPage] Fetch url https://cdn.weread.qq.com/web/wrwebnjlogic/css/app.56baec15.css
[2024-09-28 22:18:53,272][INFO][WeReadWebPage] Fetch url https://cdn.weread.qq.com/web/wrwebnjlogic/js/app.e86c9e20.js
[2024-09-28 22:19:53,848][INFO][WeReadWebPage] Current html saved to webpage.html
[2024-09-28 22:19:53,899][INFO][WeReadWebPage] Current screenshot saved to screenshot.jpg
[2024-09-28 22:19:53,899][INFO][WeReadWebPage] load selector timeout
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "D:\User\Desktop\test\weread-exporter\weread_exporter\__main__.py", line 158, in <module>
    main()
  File "D:\User\Desktop\test\weread-exporter\weread_exporter\__main__.py", line 154, in main
    loop.run_until_complete(async_main())
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\asyncio\base_events.py", line 654, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "D:\User\Desktop\test\weread-exporter\weread_exporter\__main__.py", line 92, in async_main
    await exporter.export_markdown(args.load_timeout, args.load_interval)
  File "D:\User\Desktop\test\weread-exporter\weread_exporter\export.py", line 353, in export_markdown
    markdown = await self._page.get_markdown()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\User\Desktop\test\weread-exporter\weread_exporter\webpage.py", line 405, in get_markdown
    raise RuntimeError("Wait for creating markdown timeout")
RuntimeError: Wait for creating markdown timeout
[2024-09-28 22:20:03,994][INFO]terminate chrome process...
Estherbad commented 1 month ago

一样的问题,你有解决方案了吗

Kennethcd commented 1 month ago

对,我之前可以,现在不行了,也是像你这样