YouTube视频签名

时间:2017-04-24 02:00:10

标签: javascript youtube

我一直在使用YouTube下载程序,我的大部分内容都在运行。

某些视频(即Vevo视频)具有加密签名,例如:

https://www.youtube.com/watch?v=v2AC41dglnM

所以我找到了视频播放器并获取了javascript:

https://youtube.com/yts/jsbin/player-en_US-vflchU0AK/base.js

我抓住签名功能和对象:

var BE={
    lW:function(a,b){
        var c=a[0];
        a[0]=a[b%a.length];
        a[b]=c
    }, 
    e9:function(a){
        a.reverse()
    },
    TM:function(a,b){
        a.splice(0,b)
    }
};

CE=function(a){
    a=a.split("");
    BE.lW(a,58);BE.TM(a,1);
    BE.e9(a,63);BE.TM(a,2);
    BE.lW(a,8);
    BE.lW(a,21);
    return a.join("")
};

我从YouTube视频中获取s =并通过CE功能运行:

CE("02753A38F9C9290D0778202DC28B1DFA0F291DF67.A9DECBE95FE5A74123D0FC22527374E2F2501FBCBC")

然后我尝试在url中替换s =:

https://r15---sn-5uaeznls.googlevideo.com/videoplayback?key=yt6&itag=43&mm=31&ratebypass=yes&requiressl=yes&sparams=clen%2Cdur%2Cei%2Cgcr%2Cgir%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Cratebypass%2Crequiressl%2Csource%2Cupn%2Cexpire&source=youtube&mime=video%2Fwebm&expire=1493019580&dur=0.000&lmt=1365515278685092&ip=173.48.112.179&gcr=us&ms=au&mv=m&mt=1492997904&id=o-ACO6aSSDctHIeB2fsnvl0R4IpaSTeVBeBYxVwHiVSJg5&mn=sn-5uaeznls&gir=yes&clen=32929005&initcwndbps=887500&ipbits=0&upn=ywp8mm27sXc&pl=16&ei=XFf9WPWhNYmC8gSk3wU&s=66482ABA143BFD4DF419B22142266495EF11A26D.81873834D2C06DEAFFC33A22127DE1841BAD4676

但我仍然得到了#34;访问被拒绝"来自YouTube。 我是否正确使用了破译签名?我做错了吗?

1 个答案:

答案 0 :(得分:-1)

你做得对,除了你必须在网址中添加“签名”而不是“s”这个词。

一个例子是:

https://r15---sn-5uaeznls.googlevideo.com/videoplayback?key=yt6&itag=43&mm=31&ratebypass=yes&requiressl=yes&sparams=clen%2Cdur%2Cei%2Cgcr%2Cgir%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Cratebypass%2Crequiressl%2Csource%2Cupn%2Cexpire&source=youtube&mime=video%2Fwebm&expire=1493019580&dur=0.000&lmt=1365515278685092&ip=173.48.112.179&gcr=us&ms=au&mv=m&mt=1492997904&id=o-ACO6aSSDctHIeB2fsnvl0R4IpaSTeVBeBYxVwHiVSJg5&mn=sn-5uaeznls&gir=yes&clen=32929005&initcwndbps=887500&ipbits=0&upn=ywp8mm27sXc&pl=16&ei=XFf9WPWhNYmC8gSk3wU&signature=66482ABA143BFD4DF419B22142266495EF11A26D.81873834D2C06DEAFFC33A22127DE1841BAD4676