<?
$link = $_POST['link']; // линк
// ОБРАБОТКА ПОЛУЧЕННОЙ ССЫЛКИ
if(preg_match("/http:\/\/vkontakte\.ru\/video/",$link)){ VKontakte();
}else if(preg_match("/http:\/\/vkadre\.ru\/videos/",$link)){ VKadre();
}else if(preg_match("/http:\/\/www\.youtube\.com\/watch/",$link)){ YouTube();
}else if(preg_match("/http:\/\/rutube\.ru/",$link)){ RuTube();
}else if(preg_match("/ign\.com/",$link)){ IGN();
}else if(preg_match("/http:\/\/video\.google\.com/",$link)){ VGoogle();
}else if(preg_match("/http:\/\/video\.mail\.ru/",$link)){ VMail();
}else if(preg_match("/http:\/\/www\.keezmovies\.com/",$link)){ KeezMov();
}else if(preg_match("/http:\/\/www\.1tv\.ru/",$link)){ TV1();
}else if(preg_match("/http:\/\/www\.metacafe\.com\/watch/",$link)){ Metacafe();
}else if(preg_match("/http:\/\/www\.redtube\.com/",$link)){ RedTube();
}else if(preg_match("/smotri\.com/",$link)||preg_match("/loadup\.ru/",$link)){ LoadUp();
}else if(preg_match("/liveinternet\.ru/",$link)){ Liru();
}else if(preg_match("/tnt-tv\.ru/",$link)){ TntVideo();
}else if(preg_match("/pornotube\.com/",$link)){ PornoTube();
}else if(preg_match("/musictend\.com/",$link)){ MusicTend();
}else if(preg_match("/xvideos\.com/",$link)){ Xvideos();
}else if(preg_match("/tvigle\.ru/",$link)){ Tvigle();
}else if(preg_match("/video\.bigmir\.net/",$link)){ Bigmir();
}else{
#header ("Location:
http://loadi.ru ");
echo "Service not found";
}
// РАБОЧИЕ ФУНКЦИИ
function Bigmir(){
global $link;
preg_match('/show\/([0-9]*)/',$link,$id);
$toparse = sendRequestAll("http://video.bigmir.net/extplayer/".$id[1],false);
preg_match('/movie_url=(.*?)&/',$toparse,$DATA);
if(!$DATA[1]){echo"No video files";}else{echo urldecode($DATA[1]);}
};
function Tvigle(){
global $link;
preg_match('/video=([0-9]*)/',$link,$id);
$toparse = sendRequestAll("http://tvigle.ru/xml/video.php?id=".$id[1],false);
preg_match('/[^s]url=\"(.*?)\"/',$toparse,$DATA);
if(!$DATA[1]){echo"No video files";}else{echo $DATA[1];}
};
function Xvideos(){
global $link;
$toparse = sendRequestAll($link,true);
preg_match('/flv_url=(.*?)&/',$toparse,$DATA);
if(!$DATA[1]){echo"No video files";}else{echo $DATA[1];}
};
function MusicTend(){
global $link;
preg_match('/\_([a-zA-Z0-9]*)\.html/',$link,$id);
$toparse = sendRequestAll("http://www.musictend.com/videos.php?vid=".$id[1],false);
preg_match('/Location: (.*)/',$toparse,$DATA);
if(!$DATA[1]){echo"No video files";}else{echo $DATA[1];}
};
function PornoTube(){
global $link;
preg_match('/(m=[0-9]*)/',$link,$id);
$toparse = sendRequestAll("http://www.pornotube.com/player/player.php?".base64_encode($id[1]),false);
preg_match('/mediaId=([0-9]*)&userId=([0-9]*)/',$toparse,$DATA);
if(!$DATA[1]||!$DATA[2]){echo"No video files";}else{echo "http://video2.pornotube.com/".$DATA[2]."/".$DATA[1].".flv";}
};
function TntVideo(){
global $link;
$toparse = sendRequestAll($link,false);
preg_match('/EMBED src=\"http:\/\/video\.rutube\.ru\/(.*?)\"/',$toparse,$CODE);
if(!$CODE[1]){echo"No video files";}else{echo "http://bl.rutube.ru/".$CODE[1].".flv";}
};
function Liru(){
global $link;
preg_match('/post([0-9]*)/',$link,$id);
$data = sendRequestAll("http://www.liveinternet.ru/playlist.php?a=get_v&id=".$id[1],false);
preg_match('/FLVPath=\"(.*?)\"/',$data,$DATA);
if(!$DATA[1]){echo"No video files";}else{echo $DATA[1];}
};
function LoadUp(){
global $link;
preg_match('/view\/\?id=(.*?)$/',$link,$id);
$toparse = sendRequestAll("http://smotri.com/video/view/url/?devid=LoadupFlashPlayer&after_adv=0&before_adv=1&frame_url=0&video_url=1&ticket=".$id[1],false);
preg_match('/vidURL=(.*?)&/',$toparse,$DATA);
if(!$DATA[1]){echo"No video files";}else{echo urldecode($DATA[1]);}
};
function RedTube(){
global $link;
preg_match_all('/http:\/\/www\.redtube\.com\/([0-9]*)/',$link,$CODE);
if(!$CODE[0][0]){echo"No video files";}else{
$id = $CODE[1][0];
$s="".$id;
if($s==''){$s='1';}
$pathur=''.floor($s/1000);
$l=strlen($s);
$i=1;
while($i<=7-$l){$s='0'.$s;++$i;}
$l = strlen($pathur);
$i=1;
while($i<=7-$l){$pathur="0".$pathur;++$i;}
$qsum = 0;
$i=0;
while($i<=6){$qsum = $qsum + $s[$i]*($i+1);++$i;}
$s1 = ''.$qsum;
$qsum=0;
$i=0;
while($i < strlen($s1)){$qsum = $qsum + $s1[$i];++$i;}
if($qsum>=10){$qstr=''.$qsum;} else {$qstr="0".$qsum;}
$xc = array("R","1","5","3","4","2","O","7","K","9","H","B","C","D","X","F","G","A","I","J","8","L","M","Z","6","P","Q","0","S","T","U","V","W","E ","Y","N");
$code = "";
$code = $code.$xc[ord($s[3])-48+$qsum+3];
$code = $code.($qstr[1]);
$code = $code.$xc[ord($s[0])-48+$qsum+2];
$code = $code.$xc[ord($s[2])-48+$qsum+1];
$code = $code.$xc[ord($s[5])-48+$qsum+6];
$code = $code.$xc[ord($s[1])-48+$qsum+5];
$code = $code.($qstr[0]);
$code = $code.$xc[ord($s[4])-48+$qsum+7];
$code = $code.$xc[ord($s[6])-48+$qsum+4];
$url = "http://dl.redtube.com/_videos_t4vn23s9jc5498tgj49icfj4678/".$pathur."/".$code.".flv";
echo $url;
}
};
function Metacafe(){
global $link;
$toparse = sendRequestAll($link,false);
preg_match('/mediaURL=(.*?)&gdaKey=(.*?)&/',$toparse,$DATA);
if(!$DATA[1]||!$DATA[2]){echo"No video files";}else{echo urldecode($DATA[1])."?__gda__=".$DATA[2];}
};
function TV1(){
global $link;
if(!preg_match('/http:\/\/www\.1tv\.ru\/.*?\/[0-9]$/',$link)){
$toparse = sendRequestAll($link,false);
preg_match('/xmlfile=(.*?)\"/',$toparse,$CODE);
$toparse = sendRequestAll(urldecode($CODE[1]),false);
preg_match('/<FLV_URL>(.*?)<\/FLV_URL>/',$toparse,$DATA);
if(!$DATA[1]){echo"No video files";}else{echo $DATA[1];}
}else{echo"1tv bad link";}
};
function KeezMov(){
global $link;
preg_match('/\.com\/(.*)$/',$link,$id);
$toparse = sendRequestAll("http://www.keezmovies.com//watch_player.php?id=".$id[1],false);
preg_match('/<flv_url>(.*?)<\/flv_url>/',$toparse,$DATA);
if(!$DATA[1]){echo"No video files";}else{echo urldecode($DATA[1]);}
};
function VMail(){
global $link;
preg_match_all('/video\.mail\.ru\/(.*?)\/(.*?)\/(.*?)\/(.*?)\.html/',$link,$CODE);
if(!$CODE[0][0]){echo"No video files";}else{echo "http://video.mail.ru/".$CODE[1][0]."/".$CODE[2][0]."/".$CODE[3][0]."/v-".$CODE[4][0].".flv";}
};
function VGoogle(){
global $link;
$toparse = sendRequestAll($link,false);
preg_match_all('/videoUrl....(.*?)....thumbnailUrl/i',$toparse,$CODE);
if(!$CODE[0][0]){echo"No video files";}else{echo urldecode($CODE[1][0]);}
};
function IGN(){
global $link;
$toparse = sendRequestAll($link,false);
//preg_match_all('/mediaIdHash\[\"(.*?wmvhighwide\.wmv)\"\]/',$toparse,$CODE1);
//preg_match_all('/mediaIdHash\[\"(.*?qthighwide\.mov)\"\]/',$toparse,$CODE2);
preg_match_all('/mediaIdHash\[\"(.*?flvhighwide\.flv)\"\]/',$toparse,$CODE);
if(!$CODE[0][0]){echo"No video files";}else{echo $CODE[1][0];}
};
function RuTube(){
global $link;
if(preg_match("/v=/",$link)){
preg_match_all('/v=(.*?)($|&)/',$link,$CODE);
if(!$CODE[0][0]){echo"No video files";}else{echo "http://bl.rutube.ru/".$CODE[1][0].".flv";}
}else{
$toparse = sendRequestAll($link,false);
preg_match_all('/\.rutube\.ru\%2F(.*?)\.iflv&xurl/',$toparse,$CODE);
if(!$CODE[0][0]){echo"No video files";}else{echo "http://bl.rutube.ru/".$CODE[1][0].".flv";}
}
};
function YouTube(){ //fmt_map=18/
global $link;
$toparse = sendRequestAll($link,false);
preg_match_all('/\"t\":.\"(.*?)\"/',$toparse,$CODE);
preg_match_all('/fmt_map=([0-9]*)/',$toparse,$FORMAT);
preg_match_all('/http:\/\/www\.youtube\.com\/watch\?v\=(.*?)(&.*|$)/',$link,$IDENT);
//$MP4 = "http://www.youtube.com/get_video?video_id=".$IDENT[1][0]."&t=".$CODE[1][0]."&fmt=18";
$RESULT = "http://www.youtube.com/get_video?video_id=".$IDENT[1][0]."&t=".$CODE[1][0];
if(!$IDENT[0][0] || !$CODE[0][0]){echo"No video files";}else{echo $FORMAT[1][0]."|".$RESULT;}
};
function VKadre(){
global $link;
$DATA = sendRequestAll($link,false);
preg_match_all('/vtag\=(.*?)&/',$DATA,$VTAG);
preg_match_all('/vkid\=(.*?)&/',$DATA,$VKID);
preg_match_all('/host\=(.*?)&/',$DATA,$HOST);
echo "http://".$HOST[1][0]."/assets/videos/".$VTAG[1][0].$VKID[1][0].".vk.flv";
};
function VKontakte(){
global $link;
set_time_limit(0);
$toparse="";
$req = "GET ".$link." HTTP/1.1\r\n";
$req .="Host: vkontakte.ru\r\n";
$req .="Cookie: audio_vol=80;remixchk=5;remixemail=/* EMAIL УЧЕТНОЙ ЗАПИСИ */;remixmid=/* ID */;remixpass=/* MD5 ПАРОЛЯ */;#10\r\n";
$req .="Connection: Close\r\n\r\n";
$socket = fsockopen('vkontakte.ru',80);
fwrite($socket,$req);
while(!feof($socket)){$toparse.=fgets($socket,128);}
fclose($socket);
preg_match_all('/vtag\:\'(.*?)\'/',$toparse,$VTAG);
preg_match_all('/vkid\:\'(.*?)\'/',$toparse,$VKID);
$responce = sendRequestAll("http://vkadre.ru/get_video?vkid=".$VKID[1][0]."&vtag=".$VTAG[1][0],false);
preg_match_all('/Location: (.*)/',$responce,$RESULT);
if(!$RESULT[0][0]){echo"No video files";}else{echo $RESULT[1][0];}
};
// ОТПРАВКА ЗАПРОСА
function sendRequestAll($link,$param){
set_time_limit(0);
$responce = "";
$parsed = parse_url($link);
$fsock = fsockopen($parsed[host],80,$errnum,$errstr,30);
if($param){$headers = "GET ".$parsed[path]." HTTP/1.1\r\n";} else
{$headers = "GET ".$link." HTTP/1.1\r\n";}
$headers .= "Host: ".$parsed[host]."\r\n";
$headers .= "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.8.0.2) Gecko/20060308 Firefox/1.5.0.2\r\n";
$headers .= "Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5\r\n";
$headers .= "Accept-Language: ru-ru,ru;q=0.8,en-us;q=0.5,en;q=0.3\r\n";
$headers .= "Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.7\r\n";
$headers .= "Keep-Alive: 500\r\n";
$headers .= "Content-type: application/x-www-form-urlencoded\r\n";
$headers .= "Connection: close\r\n\r\n";
fwrite ($fsock,$headers);
while (!feof($fsock)) $responce .= fread($fsock,256);
fclose ($fsock);
return $responce;
};
?>