问题描述
当字典中的 use_cipher_signature = true
通过返回时,Youtube 正在对某些视频使用密码签名http://www.youtube.com/get_video_info?&video_id=Video_Id
Youtube is using cipher signature for some of the videos when the use_cipher_signature = true
in the dictionary returned through
http://www.youtube.com/get_video_info?&video_id=Video_Id
示例 ID:_JQH3G0cCtY
Example id: _JQH3G0cCtY
加密签名实际上是任何人都可以使用几组工作签名进行调试的加扰签名.但是 Youtube 一直在改变加扰算法.我见过很少的 Youtube 视频下载器可以顺利运行而不受这个不断变化的游戏的影响.我认为他们正在检查播放器并从播放器文件中提取解码脚本,因此它们可以继续运行.
Ciphered signature is actually the scrambled signature which anybody can debug with few sets of working signatures. But Youtube keeps on changing the scrambling algo. I have seen few Youtube video downloader which are working smoothly without being affected through this changing game. I think they are checking the player and extracting the decode script from the player file and hence it keeps them going.
我需要一些有关在这种情况下使用的实际技术的帮助.我知道 'youtube-dl' - 一个用于下载视频的 Python 程序.由于我不擅长python,我认为他们使用的是相同的方法.
I need some help about the actual technique to use in this case. I am aware of 'youtube-dl' - a python program to download the videos. As I am not good in python, I think that they are using the same approach.
这里还有一个用户脚本 JS 文件:http://userscripts.org/scripts/show/25105 ,它在做同样的事情.
Also there is a user-script JS file available here: http://userscripts.org/scripts/show/25105 , which is doing the same thing.
任何有关在 PHP 或 JS 中解码密码的理智方法的帮助将不胜感激.
Any help about the sane approach to decode the cipher code in PHP or JS will be appreciated.
推荐答案
Url 结构和密码由 Youtube 不断变化.目前,解码密码签名的最佳方法解释如下:
Url structure and cipher code keeps on changing by Youtube. Presently, the best approach to decode the cipher signature is explained below:
Youtube 中的加密签名只是加扰"的签名,您必须根据播放器文件(HTML5 播放器或 Flash 播放器)中的算法重新排列它们.
Ciphered signature in Youtube are just 'scrambled' signature that you have to rearrange them according to the Algorithm present in the player file (HTML5 player or Flash player).
例如 http://www.youtube.com/watch?v=UxxajLWwzqY
目前正在使用以下 HTML5 播放器文件://s.ytimg.com/yts/jsbin/html5player-vfltdb6U3.js
For example http://www.youtube.com/watch?v=UxxajLWwzqY
is presently using the following HTML5 player file : //s.ytimg.com/yts/jsbin/html5player-vfltdb6U3.js
在此文件中,您可以通过搜索sig"轻松搜索签名解密代码.在这种情况下,算法是:
in this file you can easily search for signature decipher code by searching for 'sig'. Here in this case the Algo is:
function bz(a) {
a = a.split("");
a = cz(a, 61);
a = cz(a, 5);
a = a.reverse();
a = a.slice(2);
a = cz(a, 69);
a = a.slice(2);
a = a.reverse();
return a.join("")
}
function cz(a, b) {
var c = a[0];
a[0] = a[b % a.length];
a[b] = c;
return a
};
以上是解密代码.
但请注意,当他们更改播放器文件时,它会不断变化,因此您必须不断点击正在使用的播放器文件.
But be aware, it keeps on changing when they change the player file, so you have to keep a tap on the player file being used.
还要下载带有密码签名的视频,您必须注意发送相同的 cookie,使用相同的用户代理标头,从相同的 IP 地址发送请求,并在提取后不久发送请求.所有这些在某些时候都需要或曾经需要
Also to download videos with cipher signature you have to take care of the sending the same cookies, using the same user-agent header, sending the request from the same IP address, and sending the request shortly after extraction. All these are or were required at some point
如果对密码解密算法感兴趣,请访问CipherAPI
If interested in cipher decryption algo, please visit CipherAPI
另一个很酷的 API:TYstream API
Another cool API: TYstream API
这篇关于使用 PHP 或 JS 解码 Youtube 密码签名的最佳方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!