Dynadot Aftermarket: discover domain gems worth investing in. Visit our aftermarket.

Youtube Video Download Code: Now Working & Source Posted

SpaceshipSpaceship
SpaceshipSpaceship
Namecheap AuctionsNamecheap Auctions
Watch

thestudent

Account Closed
Impact
1
If anyone is interested, here is working code that takes a youtube url as input and redirects the user to download get_video file which is a flv.
PHP:
<?php     if($_POST["youtubeurl"]!=""){         $pagecontent = file_get_contents($_POST["youtubeurl"]);         preg_match("/v=([^(\&|$)]*)/", $_POST["youtubeurl"],$matches);         $VideoID = $matches[1];         preg_match("/\"t\": \"([^(\\\"|$)]*)/", $pagecontent,$matches);         $T_ID = $matches[1];         $VideoURL = "http://youtube.com/get_video?video_id=$VideoID&t=$T_ID";         header("Location: " . $VideoURL);     } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">  <html> <head>     <title>YouTube Downloader</title> </head> <body> <form action="youtube.php" method="post"> <b>YouTube URL:</b> <input type="Text" name="youtubeurl" size="35" value="http://youtube.com/watch?v=aFgJwRUojKw"> <br> <input type="submit" value="Download Video"> </form> </body> </html>
 
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
Why this?

if($_POST["youtubeurl"]!=""){

instead of..

if(empty($_POST["youtubeurl"])){

Also, you use double quotes too much, other than that, nice work.
 
0
Close
Great. Thank you
 
0
Close
is this still working? I'd like to download a youtube video for so long! thanks
 
0
Close
is this still working? I'd like to download a youtube video for so long! thanks

I don't think this method still works; Youtube updated their site now and It's hard to find a website that can really convert the yt videos to flv's.

:D
 
0
Close
First of all its illegal to download the videos as they have copyright by the owners of the video. Secondly YouTube from time to time update the algorithm. You can never actually help but you may have to update it as it happens. Most of the time its very difficult to track it.
 
0
Close
The algorithm is changed as stated by iamscottj...

And its really not necessary if you own IDM ;)
 
0
Close
This script looks extremely unsafe from a quick glance, you should add some safety checks and maybe do youtube video codes, instead of the URL

so instead of file_get_contents($_POST)
it should be
$code = preg_match($_POST);
$youtube = "http://youtube.com".$code;
file_get_contents($youtube)

be sure to have a pre_match settings for letters and numbers only.
 
0
Close
CatchedCatched

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Filters for activity feeds
Your news feed, Latest activity, and the activity tab on profiles now have filter buttons: All, Posts, Quick replies, and Other. Your...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back