1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-06 03:50:04 +02:00
This commit is contained in:
daniel 2020-03-20 11:06:03 -03:00
parent b84c226445
commit 968ba051b6

View file

@ -64,12 +64,12 @@ class YouTubeAPI extends PluginAbstract {
public function listVideos() {
global $global;
$youTubeObj = $this->getDataObject();
if(empty($_GET['page'])){
if (empty($_GET['page'])) {
$page = 1;
}else{
} else {
$page = intval($_GET['page']);
}
$name = "YouTubeAPI-ListVideos-{$page}";
$name = "YouTubeAPI-ListVideos-{$page}-" . md5(@$_GET['search']);
$cache = ObjectYPT::getSessionCache($name, $youTubeObj->cacheTimeout);
if (empty($cache)) {
@ -109,14 +109,14 @@ class YouTubeAPI extends PluginAbstract {
//'regionCode' => $youTubeObj->regionCode,
);
if(!empty($youTubeObj->keyword)){
if (!empty($youTubeObj->keyword)) {
$options['q'] = $youTubeObj->keyword;
}else if(!empty($_GET['search'])){
} else if (!empty($_GET['search'])) {
$options['q'] = $_GET['search'];
}
if(!empty($_GET['pageToken'])){
if (!empty($_GET['pageToken'])) {
$options['pageToken'] = $_GET['pageToken'];
}
$searchResponse = $youtube->search->listSearch('snippet,contentDetails,statistics', $options);
@ -130,13 +130,13 @@ class YouTubeAPI extends PluginAbstract {
$searchResult["id"]["videoId"], $searchResult['snippet']["title"], $searchResult['snippet']["description"], $searchResult['snippet']["thumbnails"]["high"]["url"], $searchResult['snippet']["channelTitle"], "https://www.youtube.com/embed/{$searchResult["id"]["videoId"]}");
$object->videos[] = $vid;
}
if(!empty($object->videos)){
if (!empty($object->videos)) {
$object->error = false;
ObjectYPT::setSessionCache($name, $object);
ObjectYPT::setCache($name, $object);
}else{
} else {
$oldCache = ObjectYPT::getCache($name, 0);
if(!empty($oldCache->videos)){
if (!empty($oldCache->videos)) {
$cache = $oldCache;
}
}
@ -151,7 +151,8 @@ class YouTubeAPI extends PluginAbstract {
return $cache;
}
}
/* Not ready yet
/* Not ready yet
public function upload($videos_id) {
global $global;
require_once $global['systemRootPath'] . 'plugin/YouTubeAPI/youtube-api/autoload.php';
@ -204,7 +205,7 @@ class YouTubeAPI extends PluginAbstract {
if (isset($_SESSION[$tokenSessionKey])) {
$client->setAccessToken($_SESSION[$tokenSessionKey]);
}
// Check to ensure that the access token was successfully acquired.
// Check to ensure that the access token was successfully acquired.
if ($client->getAccessToken()) {
try {
@ -367,5 +368,4 @@ class YouTubeAPI extends PluginAbstract {
}
*
*/
}