-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
下載器「片段下载失败」 #143
Comments
这个问题好像有点严重, 所有的视频都因为这个错误无法下载了. 调试了一下发现 Node.js 对下载链接无法处理(视为无效了) const request = require('request')
const fs = require('fs')
request.get('https://upos-hz-mirrorks3u.acgvideo.com/upgcxcode/25/49/99934925/99934925-1-112.flv?e=ig8euxZM2rNcNbhVhb4BhwdlhzdgnwUVhoNvNC8BqJIzNbfqXBvEqxTEto8BTrNvN0GvT90W5JZMkX_YN0MvXg8gNEVEuxTEto8i8o859r1qXg8xNEVE5XREto8GuFGv2U7SuxI72X6fTr859r1qXg8gNEVE5XREto8z5JZC2X2gkX5L5F1eTX1jkXlsTXHeux_f2o859IB_&deadline=1561877792&gen=playurl&nbs=1&oi=0&os=ks3u&platform=pc&trid=24fb38a04143467dbaff4f7fe80eae27&uipk=5&upsig=47452310f6bb5da65df07f470123763a&uparams=e,deadline,gen,nbs,oi,os,platform,trid,uipk&mid=39717974', {
headers: {
Origin: "https://www.bilibili.com",
Referer: "https://www.bilibili.com",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36",
}
}).pipe(fs.createWriteStream('test.flv')) 这会产生以下错误 (在下载器中向上传递表现为Error: EPERM: operation not permitted)
如果换成一些普通的网站却可以, 比如
下载链接里没有任何空格, 服务器也不是我能控制的, 所以我目前没有什么解决办法, 长期得不到解决的话我可能会考虑把下载器迁移到.NET Core上. |
試著修改下請求頭,對應解析出連結使用的瀏覽器之User-Agent並修改Referer至此番劇連結 const request = require('request')
const fs = require('fs')
request.get('https://upos-hz-mirrorks3u.acgvideo.com/upgcxcode/52/88/72848852/72848852-1-112.flv?e=ig8euxZM2rNcNbNMnw4BhwdlhbK3nwUVhoNvNC8BqJIzNbfqXBvEqxTEto8BTrNvN0GvT90W5JZMkX_YN0MvXg8gNEV4NC8xNEV4N03eN0B5tZlqNxTEto8BTrNvNeZVuJ10Kj_g2UB02J0mN0B5tZlqNCNEto8BTrNvNC7MTX502C8f2jmMQJ6mqF2fka1mqx6gqj0eN0B599M=&deadline=1561886571&gen=playurl&nbs=1&oi=1696929724&os=ks3u&platform=pc&trid=63b431cb93e846dda1da6bd686c4f4a9p&uipk=5&upsig=1489353a98a40b446bfe65e04e9e1c30&uparams=e,deadline,gen,nbs,oi,os,platform,trid,uipk', {
headers: {
Origin: "https://www.bilibili.com",
Referer: "https://www.bilibili.com/bangumi/play/ep259676",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:67.0) Gecko/20100101 Firefox/67.0",
}
}).pipe(fs.createWriteStream('test.flv')) 成功下載 |
使用這個頁面提供的curl命令列測試,發現一樣返回403。就懷疑是不是請求頭被伺服器返回Close了,就改了下請求頭發現可以成功下載 |
根據Powershell的文檔,指定User-Agent要使用-UserAgent參數,不能使用-Header |
所以可以說是B站的伺服器拒絕了Chrome 73的UA |
原来如此. 还是得好好根据文档来写, 那个Invoke-WebRequest也是当时由Chrome开发者工具生成的. |
解決問題,皆大歡喜 |
Reproduce : https://www.bilibili.com/bangumi/play/ep259676
Error Code :
正在下载: 盾之勇者成名录:第3话
0% [ ]internal/streams/legacy.js:59
throw er; // Unhandled stream error in pipe.
^
[Error: EPERM: operation not permitted, open 'C:\盾之勇者成名录:第3话.part0'] {
errno: -4048,
code: 'EPERM',
syscall: 'open',
path: 'C:\盾之勇者成名录:第3话.part0'
}
acgvideo.com和akamaized.net這兩種國內國外CDN都試過了
也試著在別的機器或Linux跑過,都是一樣的結果
The text was updated successfully, but these errors were encountered: