gnu-linux-libre
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [GNU-linux-libre] youtube-dl might be running non-free software from


From: rain1
Subject: Re: [GNU-linux-libre] youtube-dl might be running non-free software from
Date: Sat, 08 Jul 2017 00:25:04 +0000
User-agent: Roundcube Webmail/1.0.6

Hello.

I looked into this by editing youtube-dl to save the javascript to a file and print information about what functions it extracts from the js. Here's what I have learned:

It is a very large file: 1.2MB, 7185 lines. The majority of it is ignored because youtube-dl JSInterpreter is only used to find this "vs" function which takes up a single line:

vs=function(a){a=a.split("");us.JR(a,77);us.km(a,70);us.km(a,7);us.JR(a,70);us.rf(a,2);us.JR(a,13);us.rf(a,3);return a.join("")};

and the us structure is like this (beautified):

    var us = {
        km: function(a, b) {
            var c = a[0];
            a[0] = a[b % a.length];
            a[b] = c
        },
        rf: function(a, b) {
            a.splice(0, b)
        },
        JR: function(a) {
            a.reverse()
        }
    };

This function is used by _decrypt_signature <https://github.com/rg3/youtube-dl/blob/master/youtube_dl/extractor/youtube.py#L1147>

It seems like there are some youtube videos that require a 'signature' HTTP GET parameter to download. Sometimes the value this needs to be can be taken from the 'sig' parameter and other times it needs to be computing using the vs function with the 's' parameter as input.

<https://github.com/rg3/youtube-dl/blob/master/youtube_dl/extractor/youtube.py#L1766>

What might be of value is to see if this 'decrypt' vs function changes or if everybody gets given the same one.

youtube-dl accepts a flag: --youtube-print-sig-code which I tried, it printed this:

[youtube] Extracted signature function:
if tuple(len(p) for p in s.split('.')) == (42, 43):
    return s[82:78:-1] + s[15] + s[77:15:-1] + s[85] + s[14:1:-1]

I think this is a translation of vs from javascript into python. This is what gets executed. Here is an example of the input and output that when getting a video

input: F852AFA83EE937A57EFECB9D23FEF2FAA396B71BC4.AC43935B4C56E3C44F2823250EDF7D321F9C8160EF2 output: 061859F123D7FDE0523282F44C3E65C4B53934CA.4CB17B693AAF2FEF32D9BCEFE72A739EE38AFA25

I hope some of this information helps us get a clearer picture of the youtube-dl situation.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]