<?
$q = $_GET['s'];
$w = $_GET['w'];
$a = $_GET['a'];
require_once('ayar.php');
if($q){
$q = ereg_replace('[[:space:]]', '+', trim($q));
$old=array("Å","Å","Ä","Ä","İ","ı","Ã","ç","Ã","ö", "'" );
$new=array("s","s","g","g","i","i","c","c","o","o" ," " );
//$q = str_replace( $old, $new, $q );
$i = 100;
if(!$_GET['p']) $_GET['p']=1;
$start=((intval($_GET['p'])-1)*50)+1;
$feedURL = "http://anonymouse.org/cgi-bin/anon-www.cgi/http://gdata.youtube.com/feeds/api/videos?q=".urlencode($q)."&orderby=rating&max-results=28&start-index=".$start;
$varmi=mysql_num_rows(mysql_query("Select * from tags where tag='$q'"));
if($varmi):
mysql_query("UPDATE tags SET hit=hit+1 WHERE tag='$q'");
else:
mysql_query("INSERT INTO tags SET tag='$q', hit=1");
endif;
// read feed into SimpleXML object
$sxml = @simplexml_load_file(($feedURL));
//$sxml = mb_convert_encoding((string) $sxml , 'UTF-8' , 'ISO-8859-9');
// get summary counts from opensearch: namespace
$counts = @$sxml->children('http://a9.com/-/spec/opensearchrss/1.0/');
$total = $counts->totalResults;
$startOffset = $counts->startIndex;
$endOffset = ($startOffset-1) + $counts->itemsPerPage;
echo '<ul class="results">';
foreach ($sxml->entry as $entry) {
// get nodes in media: namespace for media information
$media = $entry->children('http://search.yahoo.com/mrss/');
// get video player URL
$attrs = $media->group->player->attributes();
$watch = $attrs['url'];
$watch=str_replace('http://www.youtube.com/watch?v=','index.php?w=',$watch);
$kod1=str_replace('index.php?w=','',$watch);
$kod=str_replace('&feature=youtube_gdata','',$kod1);
// get video thumbnail
$attrs = $media->group->thumbnail[0]->attributes();
$thumbnail = $attrs['url'];
// get <yt:duration> node for video length
$yt = $media->children('http://gdata.youtube.com/schemas/2007');
$attrs = $yt->duration->attributes();
$length = $attrs['seconds'];
$mins = floor ($length / 60);
$secs = $length % 60;
// get <gd:rating> node for video ratings
// $gd = $entry->children('http://schemas.google.com/g/2005');
if ($gd->rating) {
$attrs = $gd->rating->attributes();
$rating = @$attrs['average'];
} else {
$rating = 0;
}
// print record
//echo "<tr><td colspan=\"2\" class=\"line\"></td></tr>\n";
// echo "<tr>\n";
// echo "<td><a href=\"{$watch}\"><img src=\"$thumbnail\"/></a></td>\n";
// echo "<td><a href=\"{$watch}\">
if ($tip=='muzik'){
echo '<li><a href="'.trsil($kod).'-'.trsil($media->group->title).'.html">';
echo $media->group->title.' - '. $mins.':'.$secs .'</a></li>';
}else{?>
<div class="video_item">
<div class="video_item_img"><a href="<?=$kod.'-'.trsil(trim($media->group->title)).'.html'?>" title="<?=$media->group->title.' izle'?>"><img src="<?=$thumbnail?>" alt="<?=utf8_duzelt($media->group->title);?>" width="120" height="90" /></a> </div>
<div class="video_item_data"> <a href="<?=$kod.'-'.trsil(trim($media->group->title)).'.html'?>" title="<?=$media->group->title.' izle'?>"><?=$media->group->title;?></a> </div>
</div>
<?
//echo '<table cellspacing="10" background="tema/arka.png" width="470" height="150" border="0" cellpadding="0">';
//echo '<tr>';
//echo '<td width="18%"><a href="'.$watch.'"><img src="http://i.ytimg.com/vi/'.$kod.'/0.jpg" width="120" height="120" border="0"/></a></td>';
//echo '<td width="82%"><a href="'.$watch.'&a='.$media->group->title.'"><font color="navy">'.$media->group->title.'</font></a></td>';
//echo '</tr>';
// echo '</table>';
// echo '<li><a href="'.$watch.'">';
// echo $media->group->title.' - '. $mins.':'.$secs .'</a></li>';
}
}
$next=intval($_GET['p'])+1;
$prev=intval($_GET['p'])-1;
echo '<div class="clear"></div><li>';
if(intval($_GET['p'])>1){ echo '<a href="?s='.urlencode($q).'&p='.$prev.'">';
echo '«« önceki sayfa</a> ';
}
echo '<a href="?s='.urlencode($q).'&p='.$next.'">';
echo 'sonraki sayfa »»</a></li>';
echo '</ul>';
} else if($a=="about")
{
?>
---<?
}
else if($a=="international")
{
?>---
<?
}
else if($a=="yourself")
{
?>
---
<?
}
else if($w) {?>
<?php
yukardaki api de farklı farklı vidoelar çıkıyor düzeltemedim bu örnek kodda verdiğim gibi nasıl yapabilirim?? örneğin serdar yazınca serdar samuncu die bişiler çıkıyor anlamsız videolar??