Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
83
rated 0 times [  89] [ 6]  / answers: 1 / hits: 28364  / 11 Years ago, sun, february 2, 2014, 12:00:00

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



Example id: _JQH3G0cCtY



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.



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.



Also there is a user-script JS file available here:
http://userscripts.org/scripts/show/25105 , which is doing the same thing.



Any help about the sane approach to decode the cipher code in PHP or JS will be appreciated.


More From » php

 Answers
8

Url structure and cipher code keeps on changing by Youtube. Presently, the best approach to decode the cipher signature is explained below:



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).



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



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
};


Above is the deciphering code.



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.



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



If interested in cipher decryption algo, please visit CipherAPI



Another cool API: TYstream API


[#72786] Friday, January 31, 2014, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
mariamiyanab

Total Points: 75
Total Questions: 102
Total Answers: 92

Location: British Indian Ocean Territory
Member since Tue, Feb 22, 2022
2 Years ago
;