Comments (14)
可以提供連結嗎,因為我這邊試不出來
百度傳來的格式:
解碼方法:
from aria2-integration.
https://pan.baidu.com/s/1geOdzu7
以及能告诉我是怎么看到百度传过来的数据的吗?我想试试在我这边直接用decodeURI
试试看,也许跟系统本身默认的编码有关(我的应该是 UTF-8)
from aria2-integration.
hmmm 稍微试了一下,火狐返回的结果很奇怪,或者是百度返回的数据很奇怪,根本不是 URI 编码的。必须用 utf-8 解码两次才能拿到正确的结果。
browser.webRequest.onHeadersReceived.addListener(e => {
let encoder = new TextEncoder();
let de1 = new TextDecoder('utf-8');
for (const h of e.responseHeaders) {
if (h.name === "Content-Disposition") {
let bv = []; if (h.value) {
bv = encoder.encode(h.value);
} else {
bv = h.binaryValue;
}
console.log('Binary values: ', bv.toString());
d1 = de1.decode(bv);
console.log('after utf-8 decode: ', d1);
bv2 = [];
for (let i = 0; i != d1.length; ++i) {
bv2.push(d1.charCodeAt(i));
}
bv2 = new Uint8Array(bv2)
console.log('code points: ', bv2)
d2 = de1.decode(bv2)
console.log('utf8 decode again: ', d2)
}
}
}, {urls : [ "<all_urls>" ]}, [ "blocking", "responseHeaders" ])
from aria2-integration.
看起來是Linux版本的差異
在Windows上,browser.webRequest 傳過來時就已經轉換好了
雖然是Firefox的問題,我還是修正一下好了
但是這樣要怎麼分辨是iso-latin還是utf-8啊?
from aria2-integration.
在windows上用也存在文件名乱码,请问具体怎么解决呢?另外不能选择文件保存位置怎么解决?
from aria2-integration.
@yans006 每个问题应该单独发issue。这边的保存位置并不是通过界面完成的,需要手动输入。需要对话框可以发Feature Request。
from aria2-integration.
@RossWang
同样遇见这样的问题。
具体情况如下:
Name Firefox
Version 59.0.2
OS Linux 4.15.15-1-ARCH
网址:https://pan.baidu.com/s/1VkyPSo-_zUWPoIcbO12bBg
提取码:5vlm
截图中"File name"栏中的内容: [å��æ�¬ã�¹ã�¤].é��è�²ç��æ��å�使.03.epub
所有请求的har文件:
Archive 18-04-08 21-42-01.har.zip
from aria2-integration.
特别将最关健的一个请求单独贴在下面。
从上面的两面图中可以看出,请求参数fin
、fn
中均包含正确的文件名。
而服务器响应Content-Disposition
中则给出了一个未知编码的文件名。
$ echo '[å^Í^Áæ^ܬã^¹ã^¤].é^Ç^Ñè^ɲç^Ú^Äæ^Ö^Çå<00ad>^×使.03.epub' | iconv -f UTF-8 -t LATIN1
[十本スイ].金色的文字使.03.epub
由于复制的原因,上面代码框中的代码直接复制到终端并不能得到图片中所示的结果。
为了得到相同结果,你可以打开har文件,复制11314行中的文件名部分,替换上面bash命令中文件名部分进行执行。
当然,你也可以执行如下命令:
$ echo 'W8Olwo3CgcOmwpzCrMOjwoLCucOjwoLCpF0uw6nCh8KRw6jCicKyw6fCmsKEw6bClsKHw6XCrcKX
w6TCvcK/LjAzLmVwdWIK' | base64 -d | iconv -f UTF-8 -t LATIN1
[十本スイ].金色的文字使.03.epub
希望上述内容能够对作者有所帮助。
也希望作者能尽快修复这个bug。
from aria2-integration.
雖然是Firefox的問題,我還是修正一下好了
但是這樣要怎麼分辨是iso-latin還是utf-8啊?
也许作者可以换一个思路
比如说,对于百度盘的链接(baidupcs.com),直接从请求的fn
、fin
字段拿文件名,不理会Content-Disposition
中的内容。
from aria2-integration.
Reference:
https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/btoa
大家幫我試一下,我目前沒有環境可以測試
from aria2-integration.
在一个DZX论坛下载附件,不使用扩展可以正常下载
使用扩展会下载失败
论坛用的是GBK版
from aria2-integration.
兩個問題,第一個是編碼,第二個是無法下載
編碼的部分我在相似的網站上可以復現,但是還無解
無法下載的部分是因為Webextension API 不支持傳遞Referer,所以論壇驗證不通過
此類下載僅能透過Aria2下載
from aria2-integration.
更新了 0.4.0 版本后出现了编码错误...
下载文件的 URL 编码是
%5B%E4%B8%96%E6%8D%A8%E4%BA%BA%E3%81%AA%E6%BC%AB%E7%94%BB%E6%8F%8F%E3%81%8D%20%28%E3%81%A8%E3%82%82%E3%81%8D%E3%81%A8%E3%82%82%E3%81%AE%E3%82%8A%29%5D%20%E5%AF%BE%E5%9C%B0%E7%90%83%E4%BA%BA%E6%80%A7%E6%AC%B2%E5%88%B6%E5%BE%A1%E7%94%A8%E4%BA%BA%E9%80%A0%E4%BA%BA%E9%96%93%E3%82%A2%E3%83%AA%E3%82%B9%20%28%E4%B8%8D%E6%80%9D%E8%AD%B0%E3%81%AE%E5%9B%BD%E3%81%AE%E3%82%A2%E3%83%AA%E3%82%B9%29%20%5B%E4%B8%AD%E5%9B%BD%E7%BF%BB%E8%A8%B3%5D%20%5BDL%E7%89%88%5D.zip
被解析为
[�hºj+;ÏM (h‚Mh‚nŠ)] þ0�º'26¡(º º“¢ê¹ (�pnýn¢ê¹) [-ýû3] [DLH].zip
from aria2-integration.
我不太懂这个, 很可惜帮不上忙...
from aria2-integration.
Related Issues (20)
- 插件的預設下載路徑設置失敗 HOT 1
- 从连接的download属性获取文件名
- Update AriaNg to support dark theme HOT 1
- Need a solid guide on how to add File Types to capture! HOT 1
- 建议:选中多个链接时一次下载多个文件
- 可以设置成弹出窗口的形式吗?
- 大佬,更新吗?AriaNg 更新到 1.2.3 了。 HOT 2
- 新特性建议:能否可以给一个浏览器通知的关闭与展示按钮(强迫症表示很难受)
- Dark mode for extension
- 手动替换升级AriaNg-1.2.4后,点击新建提示aria2状态未连接 HOT 3
- 使用有secret的rpc时,点击链接所弹出的窗口的下载按钮所开启的下载任务总是失败。
- 如何快速打开插件的/data/options/menu.html目录
- Update AriaNG to 1.2.5 HOT 1
- 希望增加断开重连,网络有时不稳定。
- [Bug]启用插件并打开拦截功能后Firefox退出后无法启动
- [Feature Request] Allow opening AriaNg in the sidebar
- Is it only me or the check Aria2 Auto Start don't work anymore?
- how to use this? HOT 2
- 希望可以在下载时选择是否使用代理 HOT 1
- (功能建议)在拦截下载链接之后弹出的请求下载窗口中增加当前下载项的代理设置
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aria2-integration.