ÿØÿà 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/ |
<?php if ($_GET['q'] && $_GET['maxResults']) { // Call set_include_path() as needed to point to your client library. require_once 'Google/Client.php'; require_once 'Google/Service/YouTube.php'; /* * 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 = 'AIzaSyDTpWU1T3AR7dFZg0b9gZD1WdIWdDUt1-E'; $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); $mode = 'search'; if(isset($_GET['mode'])){ $mode = trim($_GET['mode']); } // Call the search.list method to retrieve results matching the specified // query term. if($mode=='search') { $searchResponse = $youtube->search->listSearch('id,snippet', array( 'q' => $_GET['q'], 'type' => 'video', 'maxResults' => $_GET['maxResults'], )); }else if($mode=='detail'){ $url = 'https://www.googleapis.com/youtube/v3/videos?part=snippet&id='.$_GET['q'].'&key='.$DEVELOPER_KEY; $content = file_get_contents($url); $arr_content =json_decode($content, true); foreach($arr_content['items'] as $val){ $detail['id_you'] = $val['id']; $detail['title'] = $val['snippet']['title']; $detail['des'] = $val['snippet']['description']; $detail['img'] = 'http://img.youtube.com/vi/'.$detail['id_you'].'/hqdefault.jpg'; } echo json_encode($detail); exit(); }else { $searchResponse = $youtube->search->listSearch('id,snippet', array( 'relatedToVideoId' => $_GET['q'], 'type' => 'video', 'maxResults' => $_GET['maxResults'], )); } $videos = ''; $channels = ''; $playlists = ''; // Add each result to the appropriate list, and then display the lists of // matching videos, channels, and playlists. /* print_r($searchResponse); exit();*/ $list = array(); foreach ($searchResponse['items'] as $searchResult) { $list['title'] = $searchResult['snippet']['title']; $list['id_you'] = $searchResult['id']['videoId']; $list['img'] = 'http://img.youtube.com/vi/'.$searchResult['id']['videoId'].'/hqdefault.jpg'; $list2[] = $list; } echo json_encode($list2); exit(); } ?>