Here is a small php script which will grab Mega Video download link and is able to stream it to JW Player. Streaming uses server bandwidth due to MV same IP restriction. The script supports paid accounts for bypassing Megavideo time limit and showing streams to your users ( Technique used by many Anim sites ).
About
You are currently browsing the NGCoders – Next Generation Coders weblog archives.


very nice post.
It has some error,when i click to download the video its not showing its extension,i mean video extenstion the file was downloading as stream.php in mobile and in PC its just streaming and not downloading.The same error i faced in youtube script also so please fix it.
me too i have the same error
I want to use this on my wordpress blog, but I’m a beginner. please help me. what should I do?
Upload script to your host and use the stream link with jw player.
Congratulations, it’s a great script. What is exactly “same IP restriction”?
It means the ip who has requested the page only can download the flv file.
Hi nice code i download it and upload it to my hosting it plays the videos nicely but there’s only one litle problem it only plays like the 8 to 10 minutes of the video and then stops is there a way to fix this or why is it doing that becouse if you have a video that is longer then that then it will only play part of it please reply or if you are able to fix this let us know if it could play videos up to an hour or something like that.
that would be nice i want it to use it for tutorials and to show some documentals
The php script is timing out. Put set_time_limit(0) at top of stream.php .
hi im sorry to bother you again you said to put set_time_limit(0) at top of stream.php but the stream.php uses include funciton so should i add it to the stream.php or the curl.php? sorry for asking to many questions its just that is a nice script and i definitly would like to use it if it does stream more then what i mentioned before if you could help me please or updated i would really apreciatted. thanks again
add it to any file , itll get executed in either.
Thanks a lot! I just got one question/request:
would be possible to have an script that once you open on the browser http://website.com/megaivdeoscript.php?id=ID_OF_VIDEO downloads directly the video?
Thanks in advance!
Modify stream.php in the package.
Hello , i have installed your script , but after i put the megavideo link and pres the button , in jwplayer appears “Error #2032″ .
In the the Page Source at the player I have :
flashvars=”file=
Thanks!
Thanks Vikas. I know it must be simple but I dont know how to do it. Just to explain myself better.
The following link downloads a megavideo video jsut entering the id of the video, check it please:
http://bit.ly/dkHUhB
The bad thing is that this script only works with premium accounts. Thats why I need to do exactly the same but with premium accounts.
With your script I have managed to do something similar, but I have to press the Get Video Link button and I want something that works without needing to presse any button just enter to the link http://www.whatever.com/phpfile.php?whatever=whatever
Thanks fro the prompt reply Vikas.
The problem is that I don’t know how to do it exactly, but I know it must be quite simply. I’ll try to explain myself in a better way.
I already found a script that is doing what I need, but the problem is that it doesn’t work with premium accounts. Please check it here: http://bit.ly/8YC1ZC
So what I want is basically the same thing but for premium accounts.
With your script I managed to have something similar after modifying some things, but I still needed to press the Get Video Link button in order to have the file downloading.
In summary I want to do the necessary changes to your script so when I write http://www.whatever.com/the_php_file.php?whatever=megavideourl_or_videoid
it starts downloading the video without needing to press anything on the page.
Could you help me on this?
Thanks
Its pretty easy , Just create another file say stream2.php in same directory with following code –
[code]
< ?php
if(!isset($_GET['v']) && empty ($_GET['v'])){
die('No id found');
}
include('curl.php');
include('megavideo.php');
include('config.php');
$tube = new megavideo();
$tube->init($username, $password);
$url = "http://megavideo.com/?v=".$_GET['v'];
$download_link = $tube->get($url);
$curl = new Curl(time());
$curl->stream($download_link);
[/code]
then link to stream2.php?v={megavideo id}
Thank you veeeery much Vikas.
Just a question:
Would be possible to have this script but without curl? The reason what I want it without curl is that I’m runing the script on my multimedia player and it can run php files but not curl (curl init error).
I got some other scripts that can do the work without curl, but you have to write the cookie manually on the php file. That’s why your script would be even more perfect if it could be done without curl
Thanks again Vikas!
Just a question, how you find the decrypt of megavideo?
Please check MV Class
thx
Hi Vikas,
Im sorry for the double posts. I can see that you still didnt approved the comment si you can just delete them.
I have found a way to modify slighlt your scripts so I can do what I wanted.
Check this link on vlc for example: http://bit.ly/dhQh0S
The problem is than sam (comment above) the video stops the playback (or download if I try to download it) after 6-7 minutes in my case.
I added set_time_limit(0); to the top of stream.php and it didnt solve the issue. Then i added it to the top of all the php files, but it didnt solve it neither. Any other tip?
Thanks in advance!
Please ask host to increase php script timeout,through php.ini.
Thanks!! I managed to have a php.ini inside my dreamhoste website and know it works
I gues that if I use this script so all the visitors of my website can watch the videos my mv account will be cancelled very soon. Am I wrong?
Nope , Your account will not get canceled. MV sees use from single IP only!!! Ive had this script installed on sites with Alexa < 10k.
But it is recommend you host it on separate server than script server if you have a high traffic site.
I see… So I guess that mv only see the ip of the website. Am I right? Is that thanks to the readfile parameter?
Thanks a lot Vikas. I’m learning a lot
hey man i love your script but the problem i am having is in firefox. everytime i click to download the file it tries to download the php file rather than actual file. please help
hey man i was womdering if u could show me how to make it so instead of going to my website and putting megavideo link in the box to stream it they can do it via link. for example http://example.com/stream/megavideoid. sort of like the above post but to go directly to streaming instead of downloading
Question some urls are of megaupload
http://www.megavideo.com/?d=1G5PE7XD
but script cant decode. url change with value ‘d’
do you create new version?
or add some function to class?
Regards
Hi its me again i manage to find the ini.php in my host i just have a question could you help me out by telling me how to increase the time in that file what do i need to add to the php.ini file any help would be grately apreciated.
Thanks in advance
You guys need to research a little bit more.
albert to support V and D links open megavideo.php
Search [CODE]if (preg_match(‘%megavideo\.com/\?v=([A-Z0-9]+)%’,$url,$match))[/code]
and replace with
[CODE]if (preg_match('%megavideo\.com/\?(v|d)=([A-Z0-9]+)%',$url,$match))[/CODE]
why I can not play the video?
like this site http://megavideo.me.pn
???
I really like this script it works really well. But there’s a problem am not able to download the video from megavideo. Is there a way to fix this. All i need to know is a way to fix that. If possible update the script please and thank you
Hello!
I want to thank you for this wonderful script.
I have a question regarding the streaming part.
How can I make it so that the file can be stream like:
http://—-.com/stream.php?v={videoID}.flv ?
I read the post where you adviced to create a stream2.php but when I enter http://—-.com/stream2.php?v={videoID}&type=flv as the file source, the player gives an error.
Thanks