| Server IP : 180.180.241.3 / Your IP : 216.73.216.35 Web Server : Microsoft-IIS/7.5 System : Windows NT NETWORK-NHRC 6.1 build 7601 (Windows Server 2008 R2 Standard Edition Service Pack 1) i586 User : IUSR ( 0) PHP Version : 5.3.28 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/AppServ/www/news/components/com_youtubegallery/includes/ |
Upload File : |
<?php
/**
* YoutubeGallery
* @version 3.8.3
* @author DesignCompass corp< <support@joomlaboat.com>
* @link http://www.joomlaboat.com
* @GNU General Public License
**/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
if(!defined('DS'))
define('DS',DIRECTORY_SEPARATOR);
require_once(JPATH_SITE.DS.'components'.DS.'com_youtubegallery'.DS.'includes'.DS.'misc.php');
class VideoSource_YoutubeSearch
{
public static function extractYouTubeSearchKeywords($youtubeURL)
{
//http://www.youtube.com/results?search_query=%22dogs+101%22&oq=%22dogs+101%22&gs_l=youtube.3..0l10.16119.16453.0.17975.2.2.0.0.0.0.330.649.3-2.2.0...0.0...1ac.1.GQ5tbo9Q0Cg
$arr=YouTubeGalleryMisc::parse_query($youtubeURL);
$p=urldecode($arr['search_query']);
if(!isset($p) or $p=='')
return ''; //incorrect Link
//echo $p;
//die;
$keywords=str_replace('"','',$p);
$keywords=str_replace('+',' ',$keywords);
$keywords=str_replace(' ',',',$keywords);
//$keywords=str_replace(',','%2C',$keywords);
return $keywords;
}
public static function getVideoIDList($youtubeURL,$optionalparameters,&$playlistid,&$datalink)
{
$optionalparameters_arr=explode(',',$optionalparameters);
$videolist=array();
$spq=implode('&',$optionalparameters_arr);
$videolist=array();
$keywords=VideoSource_YoutubeSearch::extractYouTubeSearchKeywords($youtubeURL);
//echo '$keywords='.$keywords.'<br/>';
//die;
if($keywords=='')
return $videolist; //WRONG LINK id not found
$url = 'https://gdata.youtube.com/feeds/api/videos?q='.urlencode($keywords).'&v=2&'.$spq;
$datalink=$url;
$xml=false;
$htmlcode=YouTubeGalleryMisc::getURLData($url);
if($htmlcode=='')
return $videolist;
if(strpos($htmlcode,'<?xml version')===false)
{
if(strpos($htmlcode,'Invalid id')===false)
return 'Cannot load data, Invalid id';
return 'Cannot load data, no connection';
}
$xml = simplexml_load_string($htmlcode);
if($xml){
foreach ($xml->entry as $entry)
{
$media = $entry->children('http://search.yahoo.com/mrss/');
$link = $media->group->player->attributes();
if(isset($link))
{
if(isset($link['url']))
{
$videolist[] = $link['url'];
}
}//if(isset($link)
}//foreach ($xml->entry as $entry)
}//if($xml){
return $videolist;
}
}
?>