I was searching for a simple script which would allow me to download videos from youtube using php. I did find some implementation but only one of them worked and it used Pear. So here is a simple script to help you download videos from youtube. Allows you to download restricted videos too by logging into youtube.
The script is a simple youtube class which uses CURL.
Sample usage of the youtube class -
include(’curl.php’);
include(’youtube.php’);
$tube = new youtube();
// Only required for restricted videos
// $tube->username = “userid”;
// $tube->password = “password”;
$download_link = $tube->get($_POST['url']);


Getting the following Error
Error locating download URL.
Ragards
Aditya
Its working fine.
Tested it.. works fine… thanks very much for the code
It’s working fine now
Thanks NGCoders
Does that code works for other websites like youtube ?
Works perfectly!
can we insert adsense code in it????
please guys???
can we insert adsense codes in it???
It is working fine. How to store in our server without click download link?
Looks promising.. but I get the following error
Error locating download URL.
I’m using php 5.2.6 with curl support enabled in the php.ini
Any ideas?
Thanks
Hello. And Bye.
hey that was great..lookind simple and easy to use..it would be good if it shows the video preview there
Don’t know why, but I am also getting the error
Error locating download URL.
Are there anything that I should change to run the script properly?
Thanx.
Getting an error
“Fatal error: Call to undefined function curl_init() in C:\xampp\htdocs\stns\stns\video\download\curl.php on line 43
“
i am also getting that error, how can i fix that. “Fatal error: Call to undefined function curl_init() in youtube\curl.php on line 43
“
thanks for the sharing..i will try in to my site…
Hi, you safe my life.
kamleitner’s script stop working.
But your work perfect!!!
Thank you.
Awesome script! And it works great!
Thanks very much guys!
cool script, thank’s for share, i like this
It works Great on My site Jerker’s World
how to download mp4 video fmt 18 ?
plz reply via email
Hi and big thanks for those useful scripts. I have modified them so the users can choose between 3gp, flv, mp4 and hd video format to download. Demo is here: http://www.maksin.ms/youtube-video-download/
Cheers.
Can you send me a copy of your setup, please
Thanks,
Juan
Hi Maksin, How can you to 3gp download?
I need 3pg video format downlaod. help me~
Just add “&fmt=17″ in youtube.php file.
Regards.
wich line in youtube.php i add fmt ?
Thaks for this code greate job apreciate ! can somebody to make a similar code for trilulilu[.]ro?(use google cache)
its work.. thanks..
works well. i have implement in the http://www.getvidz.info
Works well !! perfect coding.
Excellent work that deserves our appreciation and thanks
Extracted on my webserver.
Gives following error…
Error locating download URL.
Pleased help me if get video url has changed etc…help help
Thanks
Sam
Hi. I am newbie in Php programing, please explain me a little more this issue:
- I have only insert this code when I post a topic in a php forum?
or I need do something else?
- The aministrator must have active any setting of the boards?
Best regards!
Your blog is very interresting for me, i will come back here..
login problems?
Your code works.Good one.Please help me with my following query asap.
I want to download few videos in a loop.How to execute this code continuously say for eg: in for loop.
What i have to do is in for loop a continuous stream of video link are submitted and downloaded one by one.Please help me with this.
Hey,
Dear it download only flv files…
its good if you provide multiple option like:
flv,mp3,mp4 etc etc ..
thanks,
Manan
Hi,
Dodnload link working, it gives a Warning: CURLOPT_FOLLOWLOCATION cannot be activated
Admin,
can you help remove warning message
tested on http://www.chatrack.frihost.net/youtube-to-flv
Hi guys.
Check: http://www.vid2pc.com
This site have a simply line script to embed “Video Downloader” on all sites and blogs..
Hey noone replied to my query.
How to run the script for an array of videos without asking for the pop up box to confirm url.Please reply.I need it for my application.
Thanks Carl for the link!
Can you please also enable the thumbnail of video on the page where the download link is provided.
Preview of a youtube video can be done with:
http://img.youtube.com/vi/feV7EgDHuBY/0.jpg
here eV7EgDHuBY is video id
Fatal error: Call to undefined function curl_init() in C:\xampp\htdocs\curl.php on line 43
Why don’t work ? How to fix it ?
Hi guys.
I think this script only works online.
I have tested and I cannot see any error. Works well.
Regards
to Radi
I think you have not sent php_curl option in php.ini file.
If you are using WAMP server then goto system tray WAMP icon->PHP extensions->select PHP_curl
OR
edit php.ini file in your php server folder find PHP_curl and remover semi-colon (;) near it and save the file.Restart your server and check the code again.
Tell me if this is working