Do you ever want to have your own youtube downloader well here is an ideea that works i've tested. One problem though if your host is not supporting CURL this script will not work. Here is the code than copy+paste+name the page to whatever you want+upload+grab and download
These code is free for takeing. But please if you have a tested ideea of how to avoid the CURL usage please let me now.
Hope you like it !
PS. If you get this error
it meens that CURL is not supported
Last edited by gidevelop on Mon Sep 03, 2007 12:59 pm; edited 1 time in total
| Code: |
| <?php
// Being submitted... if($_GET['youtube']) { // It has so run function "youtube_t" and redirect to that. $download = youtube_t($_GET['youtube']); header("Location: $download"); } // Find the matches in the result function youtube_t ($url) { $page = g_page($url); if ($page === false) { // YouTube won't load... die("No connection to Youtube could be established."); } preg_match('/watch_fullscreen\?video_id=(.*?)&l=(.*?)+&t=(.*?)&/', $page, $match); $match1 = "http://www.youtube.com/get_video?video_id="; if(!$match[1]) { // Video doesn't exist... die("The specifyed video does not exist on YouTube."); } $match1 .= $match[1]; $match1 .= "&t="; $match1 .= $match[3]; return $match1; } // Grab the YouTube page function g_page ($url) { $curl = curl_init($url); curl_setopt($curl, CURLOPT_HEADER, false); curl_setopt($curl, CURLOPT_VERBOSE, false); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); $output = curl_exec($curl); // Check for errors if (curl_errno($curl)) { trigger_error('CURL error: "' . curl_error($curl) . '"', E_USER_WARNING); $output = false; } curl_close($curl); return $output; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-gb" lang="en-gb"> <head profile="http://gmpg.org/xfn/11"> <title>Snatchr - YouTube Download FLV Movie</title> <link rel="icon" href="image/favicon.ico" type="image/x-icon" /> <link rel="stylesheet" href="style.css" media="all" type="text/css" /> <meta http-equiv="cache-control" content="no-cache" /> <meta http-equiv="content-language" content="en-gb" /> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta http-equiv="imagetoolbar" content="false" /> <meta http-equiv="pragma" content="no-cache" /> <meta name="author" content="Your name" /> <meta name="copyright" content="Copyright (c) your name - <?php echo date('Y'); ?>" /> <meta name="description" content="description goes here." /> <meta name="distribution" content="global" /> <meta name="last-modified" content="<?php echo date('l, dS F Y H:i:s T'); ?>" /> <meta name="mssmarttagspreventparsing" content="true" /> <meta name="robots" content="index, follow, noarchive" /> <meta name="revisit-after" content="7 days" /> <script type="text/javascript" src="http://www.google-analytics.com/urchin.js"></script> <script type="text/javascript">_uacct = "UA-534469-5"; urchinTracker();</script> </head> <body> <form action="<?php $_SERVER['PHP_SELF'] ?>" method="get"> YouTube Video: <input name="youtube" type="text" /> e.g. <em>http://youtube.com/watch?v=nojWJ6-XmeQ</em> <input type="submit" value="Grab and Download!" /> </form> </body> </html> |
These code is free for takeing. But please if you have a tested ideea of how to avoid the CURL usage please let me now.
Hope you like it !
PS. If you get this error
| Quote: |
| Fatal error: Call to undefined function curl_init() in C:\Programme\xampp\htdocs\index.php on line 92 |
Last edited by gidevelop on Mon Sep 03, 2007 12:59 pm; edited 1 time in total
