youtube'nun flv algoritmasını çözmeme az kaldı
youtube nin flv leri ile vaktinizi harcamayın,
hxxp://gdata.youtube.com/feeds/api/videos?q=aranacak_kelime&max-results=50
ile xml yapısında videoları çekip
hxxp://gdata.youtube.com/feeds/api/videos/youtube_id
ile videoların detaylarını (başlık süre etiket vs) alıp
hxxp://i.ytimg.com/vi/youtube_id/0.jpg (büyük resim)
hxxp://i.ytimg.com/vi/youtube_id/1.jpg (küçük resim)
hxxp://i.ytimg.com/vi/youtube_id/2.jpg (küçük resim)
hxxp://i.ytimg.com/vi/youtube_id/3.jpg (küçük resim)
üstteki kodlarla video resimlerini alıp son olarak da aşağıdaki kodlarla videonun flv adresini çekin
<?php
$videoid=$_GET["v"];
$format = $_GET["fmt"];
if(empty($format)) $format = 18;
$content= file_get_contents("http://youtube.com/get_video_info?video_id=$videoid");
parse_str($content);
$url = "http://www.youtube.com/get_video.php?video_id=" . $videoid . "&t=" . $token. "&fmt=".$format;
$headers = get_headers($url);
foreach($headers as $h){
if(strpos($h,"googlevideo.com")!=false){
$url = substr($h,10);
break;
}
}
header("Location: $url");
?>kullanımı proxy.php?v=youtube_id&fmt=x
youtube nin &fmt değişkeni ile ilgili ayrıntılı bilgiyi
YouTube - Wikipedia, the free encyclopedia adresinden alabilirsiniz.
başka bir başlıkta yazdığım cümleden dolayı bir sürü özel mesajla youtube den flv adresi çekme ve türkiyede kapalı olmasına rağmen nasıl video çekeceğini soranlar oldu, artık burdan bakıp yaparlar.
inşallah sizinde işinize yarar. çalışmalarınızda başarılar diliyorum...
Edit:
aşağıdaki gibi bir fonksiyon yazarak video bilgilerini alabilirsiniz
function video_details($video_data, $url, &$info)
{
$full = implode("\n", $video_data);
$full = str_replace("\n", "", $full);
// video baslik
if(preg_match("/<media:title type=\'plain\'>(.*?)<\/media:title>/", $full, $matches) != 0)
{
$info['video_title'] = $matches[1];
}
// video aciklama
if(preg_match("/<media:description type=\'plain\'>(.*?)<\/media:description>/", $full, $matches) != 0)
{
$info['description'] = $matches[1];
}
// etiketler
if(preg_match("/<media:keywords>(.*?)<\/media:keywords>/", $full, $matches) != 0)
{
$info['tags'] = $matches[1];
}
// video suresi
if(preg_match("/<yt:duration seconds=\'(.*?)\'\/>/", $full, $matches) != 0)
{
$info['yt_length'] = $matches[1];
}
// mp4/3gp
if(preg_match("/\/><media:content url=\'(.*?)\' type=\'video\/3gpp\'(.*?)\/>/", $full, $matches) != 0)
{
$info['mp4'] = $matches[1];
}
// link
if(preg_match("/<media:player url=\'(.*?)\'\/>/", $full, $matches) != 0)
{
$info['direct'] = $matches[1];
}
// youtube video id
preg_match("/v=([^(\&|$)]*)/", $url, $matches);
$info['yt_id'] = $matches[1];
// flv
$info['url_flv'] = get_flv($url);
// thumb resim linki (bunu kullanmanıza gerek yok)
$info['yt_thumb'] = get_thumb_link($video_data);
}