aria2 icon indicating copy to clipboard operation
aria2 copied to clipboard

libz::inflate() failed. cause:incorrect header check

Open evgo2017 opened this issue 5 years ago • 4 comments

Question: Download https://api.bilibili.com/x/v1/dm/list.so?oid=71163662 error (Windows && Linux). Some Header: Content-Encoding: deflate. I set the http-accept-gzip, but it's stil error.

ERROR:

[ERROR] CUID#9 - Download aborted. URI=https://api.bilibili.com/x/v1/dm/list.so?oid=71163662 Exception: [AbstractCommand.cc:350] errorCode=1 URI=https://api.bilibili.com/x/v1/dm/list.so?oid=71163662 -> [GZipDecodingStreamFilter.cc:110] errorCode=1 libz::inflate() failed. cause:incorrect header check

Thanks!

evgo2017 avatar Jul 13 '19 03:07 evgo2017

OMG! I found out why!

I successfully decompressed it using node.js today. The reason is zlib.DeflateRaw.

Compress data using deflate, and do not append a zlib header.

So when it needs to be decompressed, it should use zlib.InflateRaw instead of zlib_inflate.

There are some code: const zlib = require('zlib'), https = require('https'), fs = require('fs') const request = https.get('https://api.bilibili.com/x/v1/dm/list.so?oid=71163662') request.on('response', (res) => { res.pipe(zlib.createInflateRaw()).pipe(fs.createWriteStream('index.xml')) })

And I have tried curl before. It work. curl -O url --compressed

Hope it can be fixed! Thanks!!!

evgo2017 avatar Jul 21 '19 15:07 evgo2017

老哥能教下怎么做吗?用yt-dlp下载b站视频出现这个问题了,我不是专业的,你说的我看不懂。

lhs55502002 avatar May 01 '23 00:05 lhs55502002

老哥能教下怎么做吗?用yt-dlp下载b站视频出现这个问题了,我不是专业的,你说的我看不懂。

这是因为B站弹幕服务器使用的 deflate 编码比较偏,aira2不支持,所以解析错误。 你可以搜搜 deflate 相关内容看看。

evgo2017 avatar May 01 '23 01:05 evgo2017

感谢老哥的提示,成功用 curl 下载。

我之前在浏览器中能顺利地下载。后来觉得复制粘贴太麻烦了,想写个脚本用 aria2 下载,结果遇到这种问题。我也不是专业的,希望我的经验能帮到后来者:

如果只是想用命令行下载弹幕,没有其他高阶的需求的话,Windows 的命令如下

curl --compressed -o 保存的文件名 弹幕链接
curl --compressed -o “114 514.xml” https://comment.bilibili.com/114514.xml
curl --compressed -o "D:\saved file\114514.xml" https://comment.bilibili.com/114514.xml

如果文件名不指明路径的话,会保存到当前目录。可以在文件名中指明路径或用 cd 更改保存路径。

InMirrors avatar May 01 '24 19:05 InMirrors