creceveur
asked on
Encrypting YouTube Video Embed's using Javascript
This site somehow encrypts the video embed link going to YouTube. It disables being able to click on the video and go to YouTube, disables the related video's at the end, and also the source. I've attached a snippet of the code from the site. I'd like to be able to do this for a site I own, and am wondering how it's done. Ideally if someone could show me how this is being done, or provide a code snippet taking the input http link to the youtube video and spitting out the "encrypted" code to plant on the page would be ideal.
<script language='javascript'>
yts='ppSIysSMkZKX0sbFnJuawJafhIaGlpDYlJeU1Y3Ty65xWXU1aVY0TEkvYmcxaGApYnR+LiQyOjAsKy88MDotKxQGCxguQ1NJS11DREINV1tZGUofTRlMHhhCMBscS19NYCJ/YWZ+TGdoKmF2bGpyIDI7NzAgdXFsUnl6OHdgfngDDQMQFwwCWkoKBhgFCVQrQkYxNzZDM1o5PEw/UUxPHOasu7XGvauzvL2/vr+4ur+goaKxtLKtnbi5+bChvbn8z8XHwcXWw5qKwd7f3JeBgNTexd3Y2tfTltTb2M7S09qkqKPtp6qr6Li8qOS/paGsu6azpbH6tba6qvW9sLytt8+SlYWIhJWPxoqLic+bi52DmJ2dycHax9TL1sve3dk7CyIjZy47Jy9+Y294ZTMtNzE5M201PTc/Ozo8Jxc+P0MKHwMDTUNOT0FeFg4KDgQQSxIYFBIUFx8CMBscXhUCYGZ8Y2N+TGdoKmF2bGpyPzEjMz50Ozc6PWR4NjMrNzpCQRQCCBADWkpOSkBMFU5EUFZQU1tLVlBDc1pbH1ZDX6e98uL25Oun5ujn7rGv//rx/fvn7be24fn17/6hv/b2x8mAg4ubhoCTo4qLz4aTj5eNwtLG1NuX1tjX3oGf39OsrrWtobGxqLqio6Wr7+65sb2ntun3v7msvKi1vbH8/8/fwsTf78bHi8LXy8vRno6CkJ/TmpSbksXbm5eQkolTYnBqdHFHZGtseXguLXhufGR3LjZ7c2F9azg7MyM+OBsrAgNHDhsHDxVaSl5MQw9eUF9WCRdTWVlbVl52bmttDGNiNSUpMyJ1aywqID4rbXB+bHNzblx3eDpxZnx6Yi8BEwMORAsHCg1USA4CDAwDFTkgNjJXVgEZFQ8eQV8YHuzy56Gkqrinr7KAq6zurqStsbWv8fj08vy5vaCWvb78i5yChNfXxZqKjoqAjNWOhJCWkJOTjryXmNqRhpyaydaktar+5uLm7Oiw6uDs6uzv9+rY8/S2/er4/rK+tbq2q93DxcPPxZzHw8nNyczK1eXQ0ZHYydXRg4GJn8benI5wbWtgZXFvaGYmciZ/ZWFse2ZzZXE4cHt5anI5PDolFQABQQgZBQFQRUZOThEPWl1RX0FDVUdTWUwbGhwHNx4fI2p/Y2MkKisnPiQuODohPTs4PDRpdz85LDwoNT0xfH9HWmhDRAZNWkhODwUNDwIKGAMXFUlXEBYUCh9ZXFpFdaCh4ai5paG5tKbv5u7o6rG3qpiztPa9qri+prTz//T6w9Wcg4OerIeIzcXI2cDLwcSfxcHdwdOf25CBscG3';
function yt(b) {a = "";c = a;strl = 0;for (var a = 0; a < strl; a++) {ky = ((a + a) + 1);ky = (255 + ky) % 255;} eval(d(b));}
function d(b) {b = d2(b);strl = b.length;stre = "";for (var a = 0; a < strl; a++) {ky = ((strl + a) + 1);ky = (255 + ky) % 255;abe = b.charCodeAt(a);xb = abe ^ ky;eb = String.fromCharCode(xb);stre += eb;} return (stre);}
function d2(k) {var j = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";var i = "";var h, g, f;var e, d, c, b;var a = 0;k = k.replace(/[^A-Za-z0-9\+\/\=]/g, "");while (a < k.length) {e = j.indexOf(k.charAt(a++));d = j.indexOf(k.charAt(a++));c = j.indexOf(k.charAt(a++));b = j.indexOf(k.charAt(a++));h = (e << 2) | (d >> 4);g = ((d & 15) << 4) | (c >> 2);f = ((c & 3) << 6) | b;i = i + String.fromCharCode(h);if (c != 64) {i = i + String.fromCharCode(g);}if (b != 64) {i = i + String.fromCharCode(f);}}return i;}
yt(yts);
</script>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
When i encode and decode a youtube url - the code encryption does not work. Please help me regarding this.
Here is a sample script file, that i attach you....
On line 41 you will see my script taken from the youtube(embed source code) . This does not work, but the example above mentioned works perfectly.
Please help me regarding this....
Here is a sample script file, that i attach you....
On line 41 you will see my script taken from the youtube(embed source code) . This does not work, but the example above mentioned works perfectly.
Please help me regarding this....
If you really want to do something similar to the above, you could just use a simple rot and fill your functions with garbage (useless) instructions, and fill the data with useless data that gets filtered out.