WordRider Home
Welcome! Log In Create A New Profile

Advanced

http://www.megavideo.com/?v=Q3I913TR

Posted by yopcyril 
http://www.megavideo.com/?v=Q3I913TR
November 28, 2009 07:16AM
hie guys,

this msg is for Lukiz+JPEXS as they r the authors of the megaupload plugin

will u implement support for :

megavideo.com ?

as it seems to be the same service as megaupload.com

example : [www.megavideo.com]

thanks in advance++
Re: http://www.megavideo.com/?v=Q3I913TR
November 28, 2009 08:02AM
As I remember, megavideo has streamed videos, not files. FRD does not support streams.

-------------------------------------

Re: http://www.megavideo.com/?v=Q3I913TR
November 28, 2009 12:53PM
Not streams, but the stream is a file somewhere too.

After a bit of fishing I was able to find the direct download link of the stream for your example link.

Try this: [www437.megavideo.com]

I'll keep investigating if I could possibly make a plugin.
Re: http://www.megavideo.com/?v=Q3I913TR
November 28, 2009 01:51PM
From [www.longtailvideo.com]


Language: PHP
<?php // Vadi_G Megavideo Flv Finder PHP   function mv_decrypt($str_hex, $key1, $key2){ $str_bin = ""; // 1. Convert hexadecimal string to binary string for($i = 0; $i < 128; $i++){ $str_bin .= floor(hexdec($str_hex[floor($i/4)])/pow(2,(3-($i%4))))%2; } // 2. Generate switch and XOR keys $key = Array(); for ($i = 0; $i < 384; $i++){ $key1 = ($key1 * 11 + 77213) % 81371; $key2 = ($key2 * 17 + 92717) % 192811; $key[$i] = ($key1 + $key2) % 128; } // 3. Switch bits positions for ($i = 256; $i >= 0; $i--){ $temp = $str_bin[$key[$i]]; $str_bin[$key[$i]] = $str_bin[$i%128]; $str_bin[$i%128] = $temp; } // 4. XOR entire binary string for ($i = 0; $i < 128; $i++){ $str_bin[$i] = $str_bin[$i] ^ $key[$i+256] & 1; } // 5. Convert binary string back to hexadecimal $str_hex = ""; for($i = 0; $i < 32; $i++){ $str_hex .= dechex(bindec(substr($str_bin, $i*4, 4))); } // 6. Return counted string return $str_hex; }   // Is set the "file" variable? if(isset($_GET["file"])){ // Does player send video position? $pos = (isset($_GET["pos"]) ? intval($_GET["pos"]) : ""); //Obtain Megavideo ID from link $megavideo_id = $_GET["file"]; // Obtain Megavideo XML playlist file if ($content = @file_get_contents("http://www.megavideo.com/xml/videolink.php?v=".$megavideo_id)){ // Parameters which I want to obtain from XML; $parameters = Array("un", "k1", "k2", "s", "size"); $success = true; // Obtain parameters from XML one by one for($i=0; $i<Count($parameters); $i++){ $success = $success && preg_match('/ ' . $parameters[$i] . '="([^"]+)"/', $content, $match); $$parameters[$i] = $match[1]; } if($success){ // Count "dkey" from obtained parameters $dkey=mv_decrypt($un,$k1,$k2); // set URL address of video file $video_url = "http://www".$s.".megavideo.com/files/".$dkey."/".$pos; // Send headers to browser header("Content-Type: video/flv"); header("Content-Disposition: attachment; filename=video.flv;" ); header("Content-Length: ".$size); // Read video file from Megavideo server readfile($video_url); } } } ?>


That just needs translating to Java. After that we're nearly done. smiling smiley
Re: http://www.megavideo.com/?v=Q3I913TR
November 28, 2009 04:58PM
I've got this far, but it complains about ArrayIndexOutOfBounds in the third FOR loop.


Language: Java
private String decrypt(String str_hex, String str_key1, String str_key2){ char[] chr_hex = str_hex.toCharArray();   // 1. Convert hexadecimal string to binary string String str_bin = ""; for(int i = 0; i < 32; i++){ str_bin += Integer.toBinaryString(Integer.parseInt(Character.toString(chr_hex[i]), 16)); } char[] chr_bin = str_bin.toCharArray();   // 2. Generate switch and XOR keys int key1 = Integer.parseInt(str_key1); int key2 = Integer.parseInt(str_key2); int[] key = new int[384]; for (int i = 0; i < 384; i++){ key1 = (key1 * 11 + 77213) % 81371; key2 = (key2 * 17 + 92717) % 192811; key[i] = (key1 + key2) % 128; }   // 3. Switch bits positions char temp; for (int i = 256; i >= 0; i--){ logger.info(Integer.toString(i)); temp = chr_bin[key[i]]; chr_bin[key[i]] = chr_bin[i%128]; chr_bin[i%128] = temp; }   //etc... }


Is there something obvious I've done wrong?


edit: It can be called with this for example:

Language: Java
decrypt("c4b77e65a4c1e33bf0f8571c69d69027", "73692", "147815")



Edited 1 time(s). Last edit at 11/28/2009 05:15PM by ntoskrnl.
Re: http://www.megavideo.com/?v=Q3I913TR
November 28, 2009 07:06PM
You have bug in the first cycle.
This string should be aligned to 8 bytes, but the toBinaryString does not do that.

-------------------------------------

Re: http://www.megavideo.com/?v=Q3I913TR
November 29, 2009 12:06PM
Call this method:

Language: Java
private String decrypt(String str_hex, String str_key1, String str_key2) { // http://wordrider.net/forum/read.php?10,3209,3212#msg-3212   // 1. Convert hexadecimal string to binary string char[] chr_hex = str_hex.toCharArray(); String str_bin = ""; for(int i = 0; i < 32; i++) { String temp1 = Integer.toBinaryString(Integer.parseInt(Character.toString(chr_hex[i]), 16)); while (temp1.length() < 4) { temp1 = "0" + temp1; } str_bin += temp1; } char[] chr_bin = str_bin.toCharArray();   // 2. Generate switch and XOR keys int key1 = Integer.parseInt(str_key1); int key2 = Integer.parseInt(str_key2); int[] key = new int[384]; for (int i = 0; i < 384; i++) { key1 = (key1 * 11 + 77213) % 81371; key2 = (key2 * 17 + 92717) % 192811; key[i] = (key1 + key2) % 128; }   // 3. Switch bits positions for (int i = 256; i >= 0; i--) { char temp3 = chr_bin[key[i]]; chr_bin[key[i]] = chr_bin[i%128]; chr_bin[i%128] = temp3; }   // 4. XOR entire binary string for (int i = 0; i < 128; i++) { chr_bin[i] = (char)(chr_bin[i] ^ key[i+256] & 1); }   // 5. Convert binary string back to hexadecimal str_bin = new String(chr_bin); str_hex = ""; for(int i = 0; i < 128; i+=4) { str_hex += Integer.toHexString(Integer.parseInt(str_bin.substring(i, i+4), 2)); }   // 6. Return counted string return str_hex; }

With this:

Language: Java
decrypt("adae225909bb6c445fe27aa919386454", "34233", "51162")

Should return:

Language: Java
"e54017d16ca68e8a9127a38731cd7173"

Now just the rest of the plugin needs making. grinning smiley Should be pretty easy.
Re: http://www.megavideo.com/?v=Q3I913TR
November 29, 2009 01:19PM
The whole plugin is working now... Just got to do some final tests.
Re: http://www.megavideo.com/?v=Q3I913TR
November 29, 2009 02:08PM
Done. Check for plugin updates. smiling smiley
Re: http://www.megavideo.com/?v=Q3I913TR
November 29, 2009 03:17PM
Good job man smiling smiley

-------------------------------------

Sorry, only registered users may post in this forum.

Click here to login