RSS

YouTube Multiple Download Link Catcher


start on today I want to share my PHP script for you.
this is my first script. Let's Try it.

if you've any questions. just post it on comment
or send it to my email in downloaded script.
sorry for my poor english.

Try script here
Download script here



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<meta http-equiv="Content-Style-Type" content="text/css" />

<meta http-equiv="Content-Script-Type" content="text/javascript" />

<title>YouTube Multiple Download Link Catcher</title>

<script language="javascript">

function show_load(){

document.getElementById("load_div").style.display = 'block';

}

function hide_load(){

document.getElementById("load_div").style.display = 'none';

}

</script>

</head>

<body onLoad="javascript:hide_load()">

Insert Youtube link below, separated by &lt;enter><br />

e.g.<br />

http://www.youtube.com/watch?v=x0rCPVqBaj4<br />

http://www.youtube.com/watch?v=df7FIPp_Wp0<br />

http://www.youtube.com/watch?v=gEA1UpZkcCg<br /><br />

more link more take long time you catching them<br />

<form method="post" action="?act=post">

<textarea name="youtube" rows="10" cols="100"></textarea><br />

<input type="submit" value="Start Catching" onclick="javascript:show_load()" />

</form>

<div id="load_div"><img src="spin.gif" /> Catching Download Link ...</div>

<?

$act=$_GET['act'];

$youtube=$_POST['youtube'];

require_once './PEAR/HTTP.php';


function get_link($id, $redirect = false) {

$code=str_replace("http://www.youtube.com/watch?v=","",$id); // O-HFvWMms2E

$url = 'http://www.youtube.com/watch?v='.$code.'&action_confirm=action_confirm';

if ($html = file_get_contents($url)) {

if (preg_match('/\/player2\.swf\?video_id=.*?&t=(.*?)"/', $html, $match)) {

$url = 'http://youtube.com/get_video.php?video_id='.$code.'&t='.$match[1];

if ($redirect && $redirected_url = get_redirected_url($url)) {

$url = $redirected_url;

}

return $url;

}

}

return false;

}


function get_redirected_url($url) {

$res = HTTP::head($url);

if (preg_match('/^3/', $res['response_code'])) {

return $res['Location'];

}

return false;

}


if ($act=="post"){

set_time_limit(10000);

$url=explode("\r\n",$youtube);

for($a=0;$a<count($url);$a++){

if (!empty($url[$a])){

$url[$a] = get_link($url[$a],true);

$script = '<a href="'.$url[$a].'">'.$url[$a].'</a><br />';

echo $script;

}

}

} // if ($act=="post"){

?>

</body>

</html>


Copyright 2009 My PHP Scripts - jadi suka-suka gue aja. All rights reserved.