drunkdream / weread-exporter

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

下载章节暂停——已解决 #57

Open ffaffAHA opened 9 months ago

ffaffAHA commented 9 months ago

书籍已经购买。 用的命令是 python -m weread_exporter -b 339321e0813ab6d0fg019228 -o epub -o pdf --load-timeout=300 然后Ctrl+C结果是这样的 屏幕截图 2023-12-22 232025

ffaffAHA commented 9 months ago
    def handle_log(self, message):
        with open("%s.log" % self._book_id, "a+", encoding='utf-8') as fp:
            fp.write("[%s] %s\n" % (self._url, message.text))

另外结合其他同学的错误使用我使用是

    )
    parser.add_argument(
        "--load-timeout", help="load chapter page timeout", type=int, default=300,
    )
    parser.add_argument(
        "--load-interval", help="load chapter page interval time", type=int, default=20,
    )
    parser.add_argument(
        "--css-file", help="overide default css style",
    )
    parser.add_argument(
        "--headless", help="chrome headless", action="store_true", default=False
    )
    parser.add_argument(
        "--force-login", help="force login first", action="store_true", default=False
    )

命令是

python -m weread_exporter -b 书籍ID -o pdf --load-timeout=300 --headless --load-interval=20
ffaffAHA commented 9 months ago

真的很感谢作者,亚马逊中国不让买书了,Zlibrary也找不到那本书,微信读书是最后的办法了emm。 (我要找的那本书是英语单词书,真的需要纸质版更方便些)

HcoreYang commented 9 months ago

我尝试一下,感谢分享。

ffaffAHA commented 9 months ago

我尝试一下,感谢分享。

我的是windows系统,你试一试吧。

viktrewang commented 9 months ago

@ffaffAHA 多谢多谢!!pull一下吧,应该能帮到大家。

drunkdream commented 8 months ago
  • [x] 暂时就解决了,webpage.py 232行 添加了utf-8,因为gbk识别不了一些字符
    def handle_log(self, message):
        with open("%s.log" % self._book_id, "a+", encoding='utf-8') as fp:
            fp.write("[%s] %s\n" % (self._url, message.text))

另外结合其他同学的错误使用我使用是

    )
    parser.add_argument(
        "--load-timeout", help="load chapter page timeout", type=int, default=300,
    )
    parser.add_argument(
        "--load-interval", help="load chapter page interval time", type=int, default=20,
    )
    parser.add_argument(
        "--css-file", help="overide default css style",
    )
    parser.add_argument(
        "--headless", help="chrome headless", action="store_true", default=False
    )
    parser.add_argument(
        "--force-login", help="force login first", action="store_true", default=False
    )

命令是

python -m weread_exporter -b 书籍ID -o pdf --load-timeout=300 --headless --load-interval=20

编码Fix已合入#59

brokench commented 8 months ago

我用了楼主的命令,结果还是不行 [2024-01-15 22:13:22,951][INFO][WeReadExporter] Check chapter 20/插图 [2024-01-15 22:13:22,953][INFO][WeReadExporter] File cache\54c32520715e229954c8b8a\chapters\2-20.md not exist [2024-01-15 22:13:22,953][INFO][WeReadWebPage] Go to chapter 20 [2024-01-15 22:13:22,958][INFO][WeReadWebPage] Fetch url https://weread.qq.com/web/reader/54c32520715e229954c8b8ak98f3284021498f137082c2e [2024-01-15 22:13:23,505][INFO][WeReadWebPage] Fetch url https://midas.gtimg.cn/midas/minipay_v2/jsapi/cashier.js [2024-01-15 22:13:23,506][INFO][WeReadWebPage] Fetch url https://cdn.weread.qq.com/web/wpa.js [2024-01-15 22:13:23,507][INFO][WeReadWebPage] Fetch url https://weread-1258476243.file.myqcloud.com/web/wrwebnjlogic/css/app.3e110853.css [2024-01-15 22:13:23,508][INFO][WeReadWebPage] Fetch url https://weread-1258476243.file.myqcloud.com/web/wrwebnjlogic/js/app.e7373bc5.js Traceback (most recent call last): File "", line 198, in _run_module_as_main File "", line 88, in _run_code File "C:\Users\Town\Documents\wechatread\weread_exporter__main.py", line 158, in main() File "C:\Users\Town\Documents\wechatread\weread_exporter__main__.py", line 154, in main loop.run_until_complete(async_main()) File "C:\Users\Town\AppData\Local\Programs\Python\Python312\Lib\asyncio\base_events.py", line 664, in run_until_complete return future.result() ^^^^^^^^^^^^^^^ File "C:\Users\Town\Documents\wechatread\weread_exporter\main__.py", line 92, in async_main await exporter.export_markdown(args.load_timeout, args.load_interval) File "C:\Users\Town\Documents\wechatread\weread_exporter\export.py", line 353, in export_markdown markdown = await self._page.get_markdown() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Town\Documents\wechatread\weread_exporter\webpage.py", line 374, in get_markdown raise RuntimeError("Wait for creating markdown timeout") RuntimeError: Wait for creating markdown timeout [2024-01-15 22:14:41,902][INFO]terminate chrome process...