ÿØÿà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/test_upload.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';
$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);
    $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'          => $content2,
            'mimeType'      => 'application/octet-stream',
            'uploadType' => 'resumable'
        )
    );
} 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);
    $content2 = file_get_contents("cache/yt2/c.txt");
}

$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'];

    }
}
echo json_encode($detail);
exit();


/*$fileId ='1uk16jK0Oqo-tR8OlZjbsCAgRInDSFqJ9';
$content = $service->files->get($fileId, array("alt" => "media"));
while (!$content->getBody()->eof()) {
    fwrite($outHandle, $content->getBody()->read(1024));
}
exit();*/

// Print the names and IDs for up to 10 files.
// Esse resultado é importante para ver que tudo está concetado;
// Esse comando deve exibir as ultimas 3 atividades do seu drive;
$optParams = array(
    'pageSize' => 3,
    'fields' => 'nextPageToken, files(id, name)',
    'q' => "name = 'asasas.txt'"
);
$results = $service->files->listFiles($optParams);

if (count($results->getFiles()) == 0) {
    print "No files found.\n";
} else {
    print "Files:\n";
    foreach ($results->getFiles() as $file) {
        printf("%s (%s)\n", $file->getName(), $file->getId());
    }
}
//
// Fim atividades do Drive;
//


//Define variáveis de arquivos
//Aqui você pode substituir depois par algum array ou resultado do banco de dados
//Defina um bem simples inicialmente para ver que tudo funciona
$pasta      = '';   // Um exemplo aqui é /home/usuario/public_html/arquivos_upload
$arquivo    = 'asasas.txt'; // arquivo.mp4
printf("Pasta: %s || Arquivo: %s\n", $pasta, $arquivo);


//Essa é a pasta destino do Google Drive
$parentId   = '1mcl7Jb5VcaBy2qF1e9C_Wp8DA_onEefe';


if ( !empty($arquivo) ) {

    //Define localização da pasta e arquivo
    $file_path = $pasta.'/'.$arquivo;

    //Conecta no Drive da sua conta
    $file = new Google_Service_Drive_DriveFile();

    //Define nome do arquivo
    $file->setName($arquivo);

    //Define Diretório Destino lá no Google Drive
    $file->setParents(array($parentId));

    //Cria o arquivo no GDrive
    $createdFile = $service->files->create(
        $file,
        array(
            'data'          => file_get_contents('index-test-VN-02-22-05-2020.txt'),
            'mimeType'      => 'application/octet-stream',
            'uploadType' => 'resumable'
        )
    );

    /*echo $createdFile->id;
    exit();*/
    /*print_r($createdFile);
    exit();*/
    $fileId = $createdFile->id;

    $content = $service->files->get($fileId, array("alt" => "media"));

    echo $content;
    exit();

    // Grava Log do que foi feito UTC -3 horas;
    $DateTime = new DateTime();
    $DateTime->modify('-3 hours');
    $now = $DateTime->format("Y-m-d H:i:s");
    $logfile = $now.' ID: '.$createdFile->id;

    $myfile = file_put_contents('logs.txt', $logfile, FILE_APPEND | LOCK_EX);

} else {

    //Grava Log
    $now = date("Y-m-d H:i:s");
    $logfile .=$now.' =====SEM ARQUIVOS========'.PHP_EOL;

    $myfile = file_put_contents('logs.txt', $logfile, FILE_APPEND | LOCK_EX);

}

?>

ZeroDay Forums Mini