Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

youtube源无法播放 #481

Closed
steven7851 opened this issue Apr 9, 2020 · 8 comments
Closed

youtube源无法播放 #481

steven7851 opened this issue Apr 9, 2020 · 8 comments

Comments

@steven7851
Copy link
Contributor

不久前还可以,今天突然发现不行

@xianingz
Copy link

xianingz commented Apr 9, 2020

我今天刚开始用,配置了API_KEY,也是不行,log里只有163.
刚才看代码和讨论,好像现在也可以不用API_KEY?
node app.js -p 2345 -a 127.0.0.1 -o youtube joox kuwo

TUNNEL > web.push.126.net:6003
MITM > music.163.com
MITM > music.163.com
MITM > music.163.com
MITM > music.163.com
MITM > music.163.com
MITM > music.163.com
MITM > music.163.com
MITM > clientlog.music.163.com

@nondanee
Copy link
Owner

nondanee commented Apr 9, 2020

估计是 sig 变了

@xianingz
Copy link

xianingz commented Apr 9, 2020

需要我这里更改配置么?还是需要改代码。
先谢谢大佬!非常有用的东西!

@nondanee
Copy link
Owner

nondanee commented Apr 9, 2020

需要改代码的

应该是签名函数没找到,流程可参考
https://blog.maple3142.net/2018/05/05/how-to-download-youtube-video/

你改完 PR 一下吧,多谢

@xianingz
Copy link

xianingz commented Apr 9, 2020

我按照这个上面说的找到了现在的两个signature加密函数分别是Nt和Mt
然后我改了下面的代码在你的signature函数里面。
const fnNameResult = /=([a-zA-Z0-9\$]+?)\(decodeURIComponent\(c/.exec(body) const fnName = fnNameResult[1] const _argNameFnBodyResult = new RegExp( fnName + '=function\\((.+?)\\){(.+?)}' ).exec(body) const [_, funcArg, funcBody] = _argNameFnBodyResult
我测试了这几个变量,输出都是对的,和Nt和Mt符合的。但运行起来还是不work。实在不了解js,不知道其他的该怎么改了。。。

@xianingz
Copy link

今天又尝试了下,修改了其他几个地方,在我这work了。我已经提交了PR

@nondanee
Copy link
Owner

@xianingz 感谢

Rasta0501 added a commit to Rasta0501/UnblockNeteaseMusic that referenced this issue Apr 17, 2020
fix youtube sig extraction error (miss default id) nondanee#481 nondanee#484
@duhd1993
Copy link

duhd1993 commented Dec 9, 2020

好像又失效了,改版了没有assets这一项了,那个博客的信息也过时...照着youtube-dl改了一下
youtube.js

16,18c16,18
< 		let assets = /"assets":{[^}]+}/.exec(body)[0]
< 		assets = JSON.parse(`{${assets}}`).assets
< 		return request('GET', 'https://youtube.com' + assets.js, {}, null, proxy).then(response => response.body())
---
> 	        let jsUrl = /"jsUrl"\s*:\s*("[^"]+")/.exec(body)[0]
>         	jsUrl = JSON.parse(`{${jsUrl}}`).jsUrl
>         	return request('GET', 'https://youtube.com' + jsUrl, {}, null, proxy).then(response => response.body())

mac还是不行,现在是只能放前9s,🤷‍♂️。至少说明支持mp4, @nondanee 有没有时间研究下额

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants