Help | Megavideo Watch

Discussion in 'PHP' started by reovens11, Aug 22, 2010.

  1. #1
    Hello people:]

    I have a problem viewing megabytes of code video ..

    After a few minutes he stops to download ..
    this download me only 10 - 20 MB ..

    
    <?php
    // For premium accounts
    // It downlad the video in flv format
    // It doesnt work if the file is hosted on free hosting, but works from hosting like dreamhost.
    // The parameter that is after u= (in the line 46) is your megavideo premium cookie. To find it use firefox + temper data and watch a movie, you could find it there. Every user has a different cookie
    // How to call the file: http://website.com/mvpremiumflv.php?vid ... OFTHEVIDEO  
    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 "video_id" variable?
    if(isset($_GET["video_id"])){
    // Does player send video position?
    $pos = (isset($_GET["pos"]) ? intval($_GET["pos"]) : "");
    //Obtain Megavideo ID from link
    $megavideo_id = $_GET["video_id"];
    // Obtain Megavideo XML playlist file
    if ($content = @file_get_contents("http://www.megavideo.com/xml/videolink.php?v=".$megavideo_id."&u=WRITE_HERE_YOUR_MEGAVIDEO_PREMIUM_COOKIE")){
    // 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);
    }
    }
    }
    ?>
     
    
    PHP:
    I wish you would fix the code ..
     
    reovens11, Aug 22, 2010 IP
  2. reovens11

    reovens11 Peon

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Can anyone help??
     
    reovens11, Aug 25, 2010 IP
  3. Gray Fox

    Gray Fox Well-Known Member

    Messages:
    196
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    130
    #3
    Read about the readfile function, it probably has something to do with output buffering (try turning it off or outputting the file in smaller chunks)
     
    Gray Fox, Aug 25, 2010 IP
  4. reovens11

    reovens11 Peon

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    You can check it to me dear friend?
    I'm not all that good in PHP
     
    reovens11, Aug 25, 2010 IP
  5. Gray Fox

    Gray Fox Well-Known Member

    Messages:
    196
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    130
    #5
    Sorry, I don't own a MegaVideo premium account
     
    Gray Fox, Aug 26, 2010 IP
  6. Cyb3rgh0st_

    Cyb3rgh0st_ Greenhorn

    Messages:
    30
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #6
    That could be a sign of prob but u would need a megavid prem acc to check this .
     
    Cyb3rgh0st_, Aug 26, 2010 IP
  7. ThePHPMaster

    ThePHPMaster Well-Known Member

    Messages:
    737
    Likes Received:
    52
    Best Answers:
    33
    Trophy Points:
    150
    #7
    Here is a class that I used a while ago, it should still work:

    
    <?php
    /*
    MegaVideo Video Scraper
    Premium Account Required
    Written by Aziz S. Hussain
    @
    www.AzizSaleh.com
    Produced under LGPL license
    @
    http://www.gnu.org/licenses/lgpl.html
    
    Example Use of the class: megavideo.class.php
    */
    
    # Setup the URL
    $newVideo = new megaVideo('http://www.megavideo.com/?v=6PTHEVUY');
    # Work to get the link
    $newVideo->doScrape();
    # You now have the link
    echo $newVideo->getLink();
    # The link can be used for download or stream
    # To use for stream, you will need a flash player like JW Flash Player
    # http://www.longtailvideo.com/players/jw-flv-player/
    ?> 
    
    PHP:
    To use this you will need to download the mgavideo.class.php and the megavideoCookie.txt files.
     
    ThePHPMaster, Aug 26, 2010 IP
  8. reovens11

    reovens11 Peon

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Look, he writes me an error file
    www.megavideo72.coi.li/megavideo.example.php
     
    reovens11, Aug 26, 2010 IP
  9. ThePHPMaster

    ThePHPMaster Well-Known Member

    Messages:
    737
    Likes Received:
    52
    Best Answers:
    33
    Trophy Points:
    150
    #9
    Change the code I provided you to:

    
    <?php
    /*
    MegaVideo Video Scraper
    Premium Account Required
    Written by Aziz S. Hussain
    @
    www.AzizSaleh.com
    Produced under LGPL license
    @
    http://www.gnu.org/licenses/lgpl.html
    
    Example Use of the class: megavideo.class.php
    */
    
    # Include Main Class
    require_once('megavideo.class.php');
    
    # Setup the URL
    $newVideo = new megaVideo('http://www.megavideo.com/?v=6PTHEVUY');
    # Work to get the link
    $newVideo->doScrape();
    # You now have the link
    echo $newVideo->getLink();
    # The link can be used for download or stream
    # To use for stream, you will need a flash player like JW Flash Player
    # http://www.longtailvideo.com/players/jw-flv-player/
    ?> 
    
    PHP:
    I forgot to add to require the main class.
     
    ThePHPMaster, Aug 27, 2010 IP
  10. reovens11

    reovens11 Peon

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #10
    It shows me a link now, but it's not good ..
    www.megavideo72.coi.li/megavideo.example.php
     
    reovens11, Aug 29, 2010 IP
  11. ThePHPMaster

    ThePHPMaster Well-Known Member

    Messages:
    737
    Likes Received:
    52
    Best Answers:
    33
    Trophy Points:
    150
    #11
    Is your cookie information setup correctly? PM your cookie file and I'll test it.

    It's either that or megavideo has banned your IP (in that event you need to change your IP).
     
    ThePHPMaster, Aug 29, 2010 IP
  12. reovens11

    reovens11 Peon

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #12
    Good cookies file ..
    Cynthia ip and gentle It's not good ..
     
    reovens11, Aug 29, 2010 IP