ÿØÿà JFIF ÿÛ „ ( %"1"%)+...383,7(-.-
![]() Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.20 System : Linux st2.domain.com 3.10.0-1127.10.1.el7.x86_64 #1 SMP Wed Jun 3 14:28:03 UTC 2020 x86_64 User : apache ( 48) PHP Version : 7.4.20 Disable Function : NONE Directory : /var/www/html/vidoe.top/proxy/ |
<?php require_once 'Google/Client.php'; require_once 'Google/Service/YouTube.php'; /* * account phimtkdotcom * Set $DEVELOPER_KEY to the "API key" value from the "Access" tab of the * {{ Google Cloud Console }} <{{ https://cloud.google.com/console }}> * Please ensure that you have enabled the YouTube Data API for your project. */ $DEVELOPER_KEY = 'AIzaSyBG8LoVIQa1uHsy8EvyXt0gfBvPOW9UxXI'; /*$client = new Google_Client(); $client->setDeveloperKey($DEVELOPER_KEY);*/ // Define an object that will be used to make all API requests. //$youtube = new Google_Service_YouTube($client); function videoDetail($id_you){ global $DEVELOPER_KEY; $client = new Google_Client(); $client->setDeveloperKey($DEVELOPER_KEY); $youtube = new Google_Service_YouTube($client); $searchResponse = $youtube->videos->listVideos('contentDetails,snippet', array( 'id' => $id_you )); foreach ($searchResponse['items'] as $val) { $detail['id_you'] = $val['id']; $detail['title'] = $val['snippet']['title']; $detail['des'] = $val['snippet']['description']; $detail['cat_youtube'] = $val['snippet']['categoryId']; $detail['duration'] = covtime($val['contentDetails']['duration']); } return $detail; } function videoSearch($q,$max_result,$token){ global $youtube; $searchResponse = $youtube->search->listSearch('id,snippet', array( 'q' => $q, 'type' => 'video', 'maxResults' => $max_result, 'videoEmbeddable' => 'true', 'pageToken' => $token )); foreach ($searchResponse['items'] as $searchResult) { $list['title'] = $searchResult['snippet']['title']; $list['id_you'] = $searchResult['id']['videoId']; $list2['video_info'][] = $list; } $list2['nextPageToken'] = $searchResponse['nextPageToken']; $list2['prevPageToken'] = $searchResponse['prevPageToken']; return $list2; } function ListCat($legion){ global $DEVELOPER_KEY; $url = 'https://www.googleapis.com/youtube/v3/videoCategories?part=snippet®ionCode='.$legion.'&key='.$DEVELOPER_KEY; $content = file_get_contents($url); $searchResponse = json_decode($content,true); foreach($searchResponse['items'] as $val){ $list['cat_id_you'] = $val['id']; $list['cat_title'] = $val['snippet']['title']; $list2[] = $list; } return $list2; } function videoInListCat($q,$legion,$max_result,$token){ global $youtube; $searchResponse = $youtube->search->listSearch('snippet', array( 'type' => 'video', 'videoCategoryId' => $q, 'regionCode' => $legion, 'maxResults' => $max_result, 'videoEmbeddable' => 'true', 'pageToken' => $token )); foreach ($searchResponse['items'] as $searchResult) { $list['title'] = $searchResult['snippet']['title']; $list['id_you'] = $searchResult['id']['videoId']; $list2['video_info'][] = $list; } $list2['nextPageToken'] = $searchResponse['nextPageToken']; $list2['prevPageToken'] = $searchResponse['prevPageToken']; return $list2; } function videoRelated($q,$max_result){ global $youtube; $searchResponse = $youtube->search->listSearch('id,snippet', array( 'relatedToVideoId' => $q, 'type' => 'video', 'maxResults' => $max_result, )); foreach ($searchResponse['items'] as $searchResult) { $list['title'] = $searchResult['snippet']['title']; $list['id_you'] = $searchResult['id']['videoId']; $list2[] = $list; } return $list2; } function videoDuration($id_you){ global $youtube; $searchResponse = $youtube->videos->listVideos('contentDetails', array( 'id' => $id_you )); foreach ($searchResponse['items'] as $val) { $duration = covtime($val['contentDetails']['duration']); } if($duration=='0:0'){ $duration = 'Live'; } return$duration; } function covtime($youtube_time) { preg_match_all('/(\d+)/',$youtube_time,$parts); // Put in zeros if we have less than 3 numbers. if (count($parts[0]) == 1) { array_unshift($parts[0], "0", "0"); } elseif (count($parts[0]) == 2) { array_unshift($parts[0], "0"); } $sec_init = $parts[0][2]; $seconds = $sec_init%60; $seconds_overflow = floor($sec_init/60); $min_init = $parts[0][1] + $seconds_overflow; $minutes = ($min_init)%60; $minutes_overflow = floor(($min_init)/60); $hours = $parts[0][0] + $minutes_overflow; if($hours != 0) { return $hours . ':' . $minutes . ':' . $seconds; }else { return $minutes . ':' . $seconds; } } ?>