1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

is there a php script that grabs megavideo url's and plays them in divx?

Discussion in 'PHP & Perl' started by imperial109, Nov 14, 2009.

  1. imperial109

    imperial109 Regular Member

    Joined:
    Jan 19, 2009
    Messages:
    499
    Likes Received:
    361
    Does anyone know of such a script?
     
  2. showboytridin

    showboytridin Regular Member

    Joined:
    Sep 5, 2009
    Messages:
    348
    Likes Received:
    714
    Location:
    127.0.0.1
    Well, scripting languages will not play the divx videos. You need to get a player. You can get the urls with PHP.
     
  3. imperial109

    imperial109 Regular Member

    Joined:
    Jan 19, 2009
    Messages:
    499
    Likes Received:
    361
    how do u get the avi video?
     
  4. hip_hop_x

    hip_hop_x Jr. VIP Jr. VIP Premium Member

    Joined:
    Aug 27, 2009
    Messages:
    299
    Likes Received:
    61
    Occupation:
    Developer
    Home Page:
    it may be possible to play with the divx web player, but first i'll have to find the divx web api, or to see some examples.
     
  5. imperial109

    imperial109 Regular Member

    Joined:
    Jan 19, 2009
    Messages:
    499
    Likes Received:
    361
    i think im going to cry >}
    all i want to know is if there is a way to get the direct link from a video from megavid

    i know that the divx web player is not a script and has to be embeded within a script and the url to an avi has to be added to the video code embed that you can get by using php variables by getting the video with a script by putting in the url of the video........but how do you get a script to get the avi video when you put in the url!!!!?

    thank you, i hope that clears something up
     
  6. thaorius

    thaorius Junior Member

    Joined:
    Aug 19, 2008
    Messages:
    109
    Likes Received:
    33
    Yes, it's possible to extract megavideo's video urls. Just emulate what the player does.

    For instance, here: http://www.megavideo.com/?v=PDGY09BO
    Check the sources and look for "<embed", you'll see "<embed src="http://www.megavideo.com/v/PDGY09BOdd25c9a8fbb2c02157e89cfe73c9dac5" type="......", there is the embed URL of the player.
    If you put that URL on the browser, it will 302 redirect to "http://wwwstatic.megavideo.com/mv_player.swf?image=http://img3.megavideo.com/d/d/25c9a8fbb2c02157e89cfe73c9dac5.jpg&v=PDGY09BO", where you can clearly see in the URL the image(background image that shows on the video) and an id, named "v"(short for video would be my guess). Next the player calls this 2 URLs with the "v" id: "http://www.megavideo.com/xml/player_login.php?u=&v=PDGY09BO
    " and "http://www.megavideo.com/xml/videoad.php?uid=1258325079240
    ". As you can see, that's login and ad information, irrelevant. Now, it loads "http://www.megavideo.com/xml/videolink.php?v=PDGY09BO&width=1680&id=1258325433624&u=", which has all the moolah you need. In that data mashup you'll find your video URL.

    As for the uid/id param on the last 2 request, I'm not sure where it get's them from, you might want to decompile the flash player and check.
     
  7. imperial109

    imperial109 Regular Member

    Joined:
    Jan 19, 2009
    Messages:
    499
    Likes Received:
    361
    The last two have to do with the megaupload subdomain. If you have ever tried downloaded something and tried to get a direct link, you will see that there is a www plus a number. Such as www569.megauplo......

    That's where I'm kinda stuck though
     
  8. thaorius

    thaorius Junior Member

    Joined:
    Aug 19, 2008
    Messages:
    109
    Likes Received:
    33
    Well, the last URL, the wwwXXX.mega... seems to be the video feed. At least my FireBug was "loading" it while the video loaded; stopped when the video finished loading, thus, it's the feed. This are the returned headers:
    Server Apache/1.3.37 (Debian GNU/Linux) PHP/4.4.7
    Content-Type video/flv
    Etag "PDGY09BO"
    Content-Length 30626529
    Content-Disposition attachment
    Cache-Control private
    Content-Transfer-Encoding binary
    Accept-Ranges bytes

    That's the video :), but it's on FLV, which is to be expected from a flash player.

    So, where are you stuck exactly? Your problems seems solved :)? You just need to open the same URLs megavideo opens, in the same order (minus the videoad, since, I doubt you want to promote their ads).
     
    • Thanks Thanks x 1
  9. imperial109

    imperial109 Regular Member

    Joined:
    Jan 19, 2009
    Messages:
    499
    Likes Received:
    361
    Oh well I appreciate answering my question from above...that's solved. But, I really don't understand half of the stuff you just said. That's why there's the big G though. I'll go look up more things and try to put something together. Unless, you want to contribute to the community, thats fine too. Either way, your awesome, you've been a big help.
     
  10. thaorius

    thaorius Junior Member

    Joined:
    Aug 19, 2008
    Messages:
    109
    Likes Received:
    33
    You'll have to excuse me for that, I didn't realize.

    You can either tell me what you did understand and I'll try to fill in the blanks here, or you may add me to your MSN/AIM/Jabber for a more fluid conversation; either way, I don't mind helping you out.

    MSN/AIM: thaorius at thaorius dot c0m
     
  11. imperial109

    imperial109 Regular Member

    Joined:
    Jan 19, 2009
    Messages:
    499
    Likes Received:
    361
    I just don't know how to get the source file of the movie. Also, you said that you load it with flash in a certain order, so there must be more than one file. However, I don't know javascript(if that is what is used here) either. I'll be streaming movies though so I was hoping to use DivX
     
  12. thaorius

    thaorius Junior Member

    Joined:
    Aug 19, 2008
    Messages:
    109
    Likes Received:
    33
    Before we move forward, 3 question for you to answer:

    1) Do you want to host the files yourself or directly stream from megavideo?
    2) How do you want to provide the stream? You want the user to see his movie player on the browser, or you want an standard Flash video player on your web just like that of megavideo?
    3) Is there a specific reason you don't want to user megavideo's flash player? Since that would be the easiest solution.
     
  13. imperial109

    imperial109 Regular Member

    Joined:
    Jan 19, 2009
    Messages:
    499
    Likes Received:
    361
    1. Stream from megavideo
    2. I would like to use the DivX player
    3. I don't like their ads and the autoplay is useless
     
  14. thaorius

    thaorius Junior Member

    Joined:
    Aug 19, 2008
    Messages:
    109
    Likes Received:
    33
    Oh well, you won't be able to use a DivX player and stream from megavideo at the same time since megavideo has it's feeds in FLV. So, your choices are:

    1) Stream from megavideo and use a custom Flash player
    2) Store the files yourself, convert them to DivX (see the documentation of ffmpeg for this), and play them on the user's DivX player.

    I suppose you prefer the first one, case in which you'll be needing someone to customize an existing Flash player (you will have to provide it's source code), or get a new one programmed from scratch (this will be quite expensive).

    As for what the Flash player must do, it should download the videolink.php?..., mount the wwwXXX.mega... URL with the data returned by the server on videolink.php, and set it's video feed URL to that wwwXXX.mega... URL. Then it would just do what it normally does, play the movie.
     
  15. imperial109

    imperial109 Regular Member

    Joined:
    Jan 19, 2009
    Messages:
    499
    Likes Received:
    361
    You can find .avi files on the two mega sites so DivX should be possible
     
  16. thaorius

    thaorius Junior Member

    Joined:
    Aug 19, 2008
    Messages:
    109
    Likes Received:
    33
    Frankly, I've never used megavideo, so I didn't know. Also, .avi doesn't mean DivX. AVI is just a container, a thin wrapper, a box, the paper that wraps the candy. You would need to inspect the actual video files and see in what format are they.

    Now, shouldn't you be able to just pull the .avi URL from the video page?
     
  17. durjoy

    durjoy Registered Member

    Joined:
    Dec 27, 2007
    Messages:
    86
    Likes Received:
    64
    you can use built in php fuction preg_match to fetch video url's from megavideo and store them on your server . pretty easy if you are good with programming .
     
  18. imperial109

    imperial109 Regular Member

    Joined:
    Jan 19, 2009
    Messages:
    499
    Likes Received:
    361
    Looks like you know something that I don't....care to share?
     
  19. dmgteam

    dmgteam Newbie

    Joined:
    May 1, 2009
    Messages:
    3
    Likes Received:
    0
    i have custom script for megavideo divx web player , using premium account ! if u are interested pm me and il provide demo , Tanks