获取YouTube视频的签名 [英] Getting the signature of a youtube video

查看:593
本文介绍了获取YouTube视频的签名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到一些Youtube视频有一个加密的签名...我已经google谷歌的问题,并发现,Youtube存储的算法在他们的HTML5 Player的Java脚本,你可以看到:
https://s.ytimg.com/yts/jsbin/html5player -iw_IL-vflC7Zf5J.js



我找到了这些功能:

  function zn(a)
{
a = a.split();
a = a.slice(2);
a = a.reverse();
a = An(a,7);
a = An(a,21);
a = a.reverse();
return a.join()
}

函数An(a,b)
{
var c = a [0]
a [0] = a [b%a.length];
a [b] = c;
return a
}

现在,我有几个问题: p>

首先,如果我有一个加密的签名,我需要通过这两个函数签名获得解密的签名,或者我必须写一个相反的函数到这个解密数据?



第二,有一种方法使其通用,或每次youtube更新其加密签名的算法,我必须重新写入? (加密函数)



谢谢!

解决方案


第二,有没有办法让它通用,或者每次youtube更新他们的加密签名的算法,我必须重新写一遍吗? (加密函数)


你可以传入一个相同长度的字符串和已知的不同值,例如 String.fromCharCode(0),String.fromCharCode(1),... - 看看它们在输出字符串中移动到哪里:这是逆转转换所需的所有信息,只要它不是破坏性的(即,输出字符串的最后长度与每个字符出现一次相同)。


一个加密的签名,我需要通过这两个函数的签名来获得解密的,或者我必须写一个相反的函数来解密数据?


听起来你可以试试看看哪些作品...?


I've noticed that some Youtube videos are having an encrypted signature... I've googled the problem a bit and found out that Youtube is storing the Algorithm in their HTML5 Player's Java Script as you can see here : https://s.ytimg.com/yts/jsbin/html5player-iw_IL-vflC7Zf5J.js

I've found those functions :

function zn(a)
{
a=a.split("");
a=a.slice(2);
a=a.reverse();
a=An(a,7);
a=An(a,21);
a=a.reverse();
return a.join("")
}

function An(a,b)
{
var c=a[0];
a[0]=a[b%a.length];
a[b]=c;
return a
}

Now, I have couple of questions :

First, If I have an encrypted signature, I need to put the signature through those 2 functions to get the decrypted one, or I have to write an opposite function to this one to decrypt the data?

Second, Is there a way to make it generic, or every time youtube updates their algorithm of the encrypted signatures, I have to re-write it again ? (the encrypted function)

Thanks!!

解决方案

Second, Is there a way to make it generic, or every time youtube updates their algorithm of the encrypted signatures, I have to re-write it again ? (the encrypted function)

You could pass in a string of the same length with known distinct values, like character String.fromCharCode(0), String.fromCharCode(1), ... - and see where they get moved to in the output string: that's all the information you need to reverse the transformation, as long as it's not destructive (i.e. the output string does end up the same length with each character appearing once).

First, If I have an encrypted signature, I need to put the signature through those 2 functions to get the decrypted one, or I have to write an opposite function to this one to decrypt the data?

Sounds like you can just try that and see which works...?

这篇关于获取YouTube视频的签名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆