1

I am writing a js+php software to make downloading of youtube videos much easier, but I encountered a following problem:

I get informations about video this way:

parse_str(file_get_contents("http://youtube.com/get_video_info?video_id=".$id),$info);

Now some of the videos returns: use_cipher_signature => True, which i would like to bypass.

I've searched trouch the Web, but all i got was some posts from 2014. (this one contains good introduction to topic: Best approach to decode Youtube cipher signature using PHP or JS)

I know that i have to look at source of https://www.youtube.com/watch?v=cipheredID, extract *base.js script and then find deciphering code in it, but *base.js is too much obfuscated for me.

Is there anyone who can help me?

And second question: Does algorithm od encoding/decoding signatures depends on location? Beceause mine is pl_PL(https://s.ytimg.com/yts/jsbin/player-pl_PL-vfluAB5bv/base.js) and for example US users will have different link en_US

Community
  • 1
  • 1

1 Answers1

0

Do you know how to extract the base.js file from a youTube link ?

M sedek
  • 81
  • 7
  • Yes, I know. I dont know how to extract deciphering function from it – yolo_swaggins1337 Oct 08 '16 at 11:49
  • Can you share the method ? I can see the file when I open the YouTube link and look at the source code, but I believe there is an easy way to get the file directly. – M sedek Oct 08 '16 at 13:08
  • something like this in php: `$ytPlayerCode=file_get_contents('http://www.youtube.com/watch?v='.$id); $dom = new DOMDocument; $dom->loadHTML($ytPlayerCode); foreach ($dom->getElementsByTagName('script') as $node) { if(strpos($node->getAttribute("src"), ".js") != false){ echo htmlspecialchars($node->nodeValue.': '.$node->getAttribute("src"))."
    "; } }`
    – yolo_swaggins1337 Oct 08 '16 at 14:36