ccloli / E-Hentai-Downloader

Download E-Hentai archive as zip file
GNU General Public License v3.0
1.9k stars 140 forks source link

更新油猴以后卡在生成压缩文件这一步 #210

Open illusoryRealist opened 2 years ago

illusoryRealist commented 2 years ago

用的chrome油猴,4月6日用的时候还正常,但自从油猴更新4.16以后就没办法下载了,下载完所有文件以后在生成压缩文件这一步无限循环,把其它插件全部关掉还是不行,看了下内存也还绰绰有余

ccloli commented 2 years ago

已测试 4.16.6160 无此问题,还请提供脚本的运行时日志,在执行时按下 F12 -> Console/控制台,然后将 [EHD] 开头的所有日志复制粘贴至此

illusoryRealist commented 2 years ago

我的锅,是我的chrome版本太老了导致的,升级以后没有这个问题了。

zeal9245 commented 2 years ago

我也遇到了同样的问题,但是由于一些原因不能更新浏览器,请问有其它解决办法吗? 运行日志:

[EHD] E-Hentai Downloader is running. [EHD] Bugs Report > https://github.com/ccloli/E-Hentai-Downloader/issues | https://greasyfork.org/scripts/10379-e-hentai-downloader/feedback [EHD] To report a bug, it's recommended to provide the logs started with "[EHD]", thanks. =w= [EHD] UserAgent > Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36 [EHD] Script Handler > Tampermonkey [EHD] Script Handler Version > 4.16.1 [EHD] E-Hentai Downloader Version > 1.33.5 [EHD] Current URL > https://exhentai.org/g/1245447/e31851112d/ [EHD] Is Logged In > true [EHD] E-Hentai Downloader Setting > {"status-in-title":"never","store-in-fs":true,"save-info":"file","save-info-list":["title","metas","uploader-comment","page-links"],"auto-download-cancel":true} [EHD] Request Resolution Setting [EHD] Request Image Limits From e-hentai.org [EHD] File System is opened! Name > https_exhentai.org_0:Temporary [EHD] Resolution Setting > {"withoutHentaiAtHome":0,"resolution":0,"timestamp":1653727494163} [EHD] Index > 2 | RealIndex > 2 | Name > _002.png | RetryCount > 0 | DownloadedCount > 1 | FetchCount > 5 | FailedCount > 0 [EHD] Index > 3 | RealIndex > 3 | Name > _003.png | RetryCount > 0 | DownloadedCount > 2 | FetchCount > 5 | FailedCount > 0 [EHD] Index > 4 | RealIndex > 4 | Name > _004.png | RetryCount > 0 | DownloadedCount > 3 | FetchCount > 5 | FailedCount > 0 [EHD] Index > 6 | RealIndex > 6 | Name > _006.png | RetryCount > 0 | DownloadedCount > 4 | FetchCount > 5 | FailedCount > 0 [EHD] Index > 1 | RealIndex > 1 | Name > _001.png | RetryCount > 0 | DownloadedCount > 5 | FetchCount > 5 | FailedCount > 0 [EHD] Request Image Limits From e-hentai.org [EHD] Index > 7 | RealIndex > 7 | Name > _007.png | RetryCount > 0 | DownloadedCount > 6 | FetchCount > 5 | FailedCount > 0 [EHD] Index > 8 | RealIndex > 8 | Name > _008.png | RetryCount > 0 | DownloadedCount > 7 | FetchCount > 5 | FailedCount > 0 [EHD] Index > 5 | RealIndex > 5 | Name > _005.png | RetryCount > 0 | DownloadedCount > 8 | FetchCount > 5 | FailedCount > 0 [EHD] Index > 10 | RealIndex > 10 | Name > _010.png | RetryCount > 0 | DownloadedCount > 9 | FetchCount > 5 | FailedCount > 0 [EHD] Index > 9 | RealIndex > 9 | Name > _009.png | RetryCount > 0 | DownloadedCount > 10 | FetchCount > 5 | FailedCount > 0 [EHD] Index > 13 | RealIndex > 13 | Name > _013.png | RetryCount > 0 | DownloadedCount > 11 | FetchCount > 5 | FailedCount > 0 [EHD] Index > 11 | RealIndex > 11 | Name > _011.png | RetryCount > 0 | DownloadedCount > 12 | FetchCount > 5 | FailedCount > 0 [EHD] Index > 15 | RealIndex > 15 | Name > _015.png | RetryCount > 0 | DownloadedCount > 13 | FetchCount > 5 | FailedCount > 0 [EHD] Index > 16 | RealIndex > 16 | Name > _016.png | RetryCount > 0 | DownloadedCount > 14 | FetchCount > 5 | FailedCount > 0 [EHD] Index > 17 | RealIndex > 17 | Name > _017.png | RetryCount > 0 | DownloadedCount > 15 | FetchCount > 5 | FailedCount > 0 [EHD] #12: Network Error [EHD] #12: RealIndex > 12 | ReadyState > 4 | Status > 0 | StatusText > Request URL > https://exhentai.org/fullimg.php?gid=1245447&page=12&key=e075aym9ug8 Final URL > https://exhentai.org/fullimg.php?gid=1245447&page=12&key=e075aym9ug8 ResposeHeaders > [EHD] Index > 12 | RealIndex > 12 | Name > _012.jpg | RetryCount > 0 | DownloadedCount > 15 | FetchCount > 5 | FailedCount > 0 [EHD] Index > 18 | RealIndex > 18 | Name > _018.png | RetryCount > 0 | DownloadedCount > 16 | FetchCount > 5 | FailedCount > 0 [EHD] Index > 19 | RealIndex > 19 | Name > _019.png | RetryCount > 0 | DownloadedCount > 17 | FetchCount > 4 | FailedCount > 0 [EHD] Index > 14 | RealIndex > 14 | Name > _014.png | RetryCount > 0 | DownloadedCount > 18 | FetchCount > 3 | FailedCount > 0 [EHD] Index > 20 | RealIndex > 20 | Name > _020.png | RetryCount > 0 | DownloadedCount > 19 | FetchCount > 2 | FailedCount > 0 [EHD] Index > 12 | RealIndex > 12 | Name > _012.png | RetryCount > 1 | DownloadedCount > 20 | FetchCount > 1 | FailedCount > 0 Uncaught (in promise) ReferenceError: abData is not defined at errorHandler (userscript.html?name=E-Hentai%20Downloader.user.js&id=8c0637e5-d43a-46de-8d5a-c8ec2adc887d:12594) [EHD] Request Image Limits From e-hentai.org

ccloli commented 2 years ago

Uncaught (in promise) ReferenceError: abData is not defined at errorHandler (userscript.html?name=E-Hentai%20Downloader.user.js&id=8c0637e5-d43a-46de-8d5a-c8ec2adc887d:12594) [EHD] Request Image Limits From e-hentai.org

    const errorHandler = function (error) {
        abData = undefined;

草,ES5 和 ES6+ 混写了,难怪会有这个错


@zeal9245 不过看起来这里不是出错的真实原因,因为这里是捕获到了错误才会进来的,只是在捕获错误时又抛出了一个错误而已。

可否辛苦帮忙在 Tampermonkey 里修改下脚本的代码?搜索下 errorHandler = function (error) {,应该就在报错的 12594 行左右,将其下面一行的 abData = undefined; 删除掉,保存,然后重新加载网页,再点击一次下载(如果是必现的话,可以只下载一张图),看看有没有报错,如果报错了再将新的错误信息复制粘贴到此。

zeal9245 commented 2 years ago

修改后的报错日志如下: [EHD] An error occurred when generating Zip file as ArrayBuffer. Error: Can't read the data of '1187644_c75bc1cc16/67364287p0.png'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ? at userscript.html?name=E-Hentai%20Downloader.user.js&id=8c0637e5-d43a-46de-8d5a-c8ec2adc887d:3573

ccloli commented 2 years ago

@zeal9245 这看起来是 Tampermonkey 更新后的问题,Firefox 下也有类似反馈(不是使用本脚本),怀疑是对沙箱之类的实现做了调整导致的。由于脚本的数据都是通过扩展程序传入的,如果扩展程序传入的数据本身就存在问题,那脚本也只能说无能为力。

可以试试看针对本脚本换用 ViolentMonkey,可能可以解决该问题

zeal9245 commented 2 years ago

非常感谢!更换ViolentMonkey后可以正常打包zip了

yingziwu commented 2 years ago

Error: Can't read the data of '1187644_c75bc1cc16/67364287p0.png'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?

@ccloli 可能相关的 issue:https://github.com/Stuk/jszip/issues/759

我之前写脚本时就遇到了这个问题,最后为了避开这个问题,ZIP 改用 https://github.com/101arrowz/fflate 这个库。

ccloli commented 2 years ago

@yingziwu 看起来不错,不过这个脚本应该不会再整个大改与重构了,没精力折腾了 🥲

yingziwu commented 2 years ago

另外,flate 除了体积比较小之外,还支持 Streaming ZIP。

参考你的《从 Fetch 到 Streams —— 以流的角度处理网络请求》这篇文章,给自己的下载器添加相应支持。

通过使用 Stream ZIP + streamsaver [1][2],在 manga.bilibili.com 下载运行时,内存占用可以稳定在 60MB 左右,最大不超过 100MB 。

yingziwu commented 2 years ago

不过这个脚本应该不会再整个大改与重构了,没精力折腾了

理解