1) { $seo_title = array_pop($p_url); } $_GET['q'] = $frontpage_keyword; // ################# Start getting Youtube GData ############################## $video_list = YT_ListByTag($_GET['q'], $_GET['p']); // ################# Start parse xml attributes manually ###################### preg_match_all('/<[^>]+>/s',$video_list[1],$tags); $i=0; foreach ($tags[0] as $k => $v) { $v = str_replace('"',"\'",$v); if (substr($v, 0, 12) == ' $v) { $id_raw = explode('/',$video_list[0][entry][$k][id]); $video_list[0][entry][$k][id] = array_pop($id_raw); $video_list[0][entry][$k][author] = $video_list[0][entry][$k][author][0][name]; $video_list[0][entry][$k][description] = $video_list[0][entry][$k]['media:group'][0]['media:description']; $video_list[0][entry][$k][category] = $video_list[0][entry][$k]['media:group'][0]['media:category']; $video_list[0][entry][$k][thumbnail][0] = "http://img.youtube.com/vi/" . $video_list[0][entry][$k][id] . "/0.jpg"; $video_list[0][entry][$k][thumbnail][1] = "http://img.youtube.com/vi/" . $video_list[0][entry][$k][id] . "/1.jpg"; $video_list[0][entry][$k][thumbnail][2] = "http://img.youtube.com/vi/" . $video_list[0][entry][$k][id] . "/2.jpg"; $video_list[0][entry][$k][thumbnail][3] = "http://img.youtube.com/vi/" . $video_list[0][entry][$k][id] . "/3.jpg"; $keywords_raw = explode(',',$video_list[0][entry][$k]['media:group'][0]['media:keywords']); $i=0; foreach($keywords_raw as $k2 => $v2) { $video_list[0][entry][$k][keywords][$i] = trim($v2); $i++; } } // ################# Start calculate pagination ############################### if((($_GET['p']+1) * $config['list_per_page']) < $video_list[0]['opensearch:totalresults']) { $next_page = $_GET['p'] + 1; } if($_GET['p']>1) { $prev_page = $_GET['p'] - 1; } // ################# Get RSS Feed ############################### $rss_head = urldecode(stripslashes($_GET['q']))."の話題"; $rss_word = urldecode(stripslashes($_GET['q'])); $rss_word = str_replace("-","+",$rss_word); $rss_word = str_replace(" ","+",$rss_word); //$rest='http://news.google.com/news?hl=en&ned=us&ie=UTF-8&q='.$rss_word.'&output=rss'; //$rest='http://blogsearch.google.com/blogsearch_feeds?hl=en&q='.$rss_word.'&ie=utf-8&num=5&output=rss'; $rest ='http://www.google.com/search?hl=en&q='.$rss_word.'&ie=utf-8&tbm=blg&num=5&output=rss'; $format='RSS/CHANNEL/ITEM'; convert_xml($rest, "process_rss", $format); function process_rss($record) { global $rss, $count, $rss_menu, $rss_id, $results, $cfg; $count++; $results .= "

$record[TITLE]
\n$record[DESCRIPTION]\n

"; //echo $results; if ($count == 5) { return 1; } } // ################# Start assign template variables ########################## // echo $video_list[0]['opensearch:totalresults']; $tpl->assign('total',ceil($video_list[0]['opensearch:totalresults'] / $config['list_per_page'])); $tpl->assign('videos',$video_list[0][entry]); $tpl->assign('keyword',urldecode(stripslashes($_GET['q']))); $tpl->assign('next_page',$next_page); $tpl->assign('prev_page',$prev_page); $tpl->assign('curr_page',$_GET['p']); $tpl->assign('bad_words',$badword_list); $tpl->assign('rss_feed',$results); $tpl->assign('rss_heading',$rss_head); $tpl->display('list.html'); ?>