title: Getting the signature of a youtube video
body: <p>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 :
  <a href="https://s.ytimg.com/yts/jsbin/html5player-iw_IL-vflC7Zf5J.js" rel="nofollow">https://s.ytimg.com/yts/jsbin/html5player-iw_IL-vflC7Zf5J.js</a></p>
  
  <p>I've found those functions :</p>
  
  <pre><code>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
  }
  </code></pre>
  
  <p>Now, I have couple of questions :</p>
  
  <p>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?</p>
  
  <p>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)</p>
  
  <p>Thanks!!</p>