ÿØÿà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/code/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/html/vidoe.top/code/live.php
<?php
include ROOT_PATH.'lib/simple_html_dom.php';
class live{
    public function __construct(){
        global $CORE;
        $code = '';
        if(isset($CORE->input['code'])){
            $code = $CORE->input['code'];
        }
        switch ($code)
        {
            default			: 	$this -> goBegin(); break;
            case 'list' : $this->goList(); break;
            case 'list2' : $this->goList2(); break;
            case 'index2': $this->goIndex2(); break;
            case 'detail2' : $this->goDetail2(); break;
            case 'search2' :  $this->goSearch2(); break;
            case 'index3'  : $this->goIndex3(); break;
            case 'topic'   : $this->goTopic(); break;
            case 'begin2'   : $this->goBegin2(); break;
        }
    }
    function goList2(){
        global $smarty,$func,$INFO,$CORE;
        $id = $CORE->input['id'];
        $day_time = date('d-m-Y');
        $url = 'https://www.youtube.com/playlist?list='.$id;
        if(!file_exists('cache/youtube/live_detail_'.$day_time.'_'.$id)){
            $content2 = $func->get_content_page($url,'https://google.com');
            if(trim($content2)!='') {
                file_put_contents('cache/youtube/live_detail_'.$day_time.'_' . $id, $content2);
            }
        }else{
            $content2 = file_get_contents('cache/youtube/live_detail_'.$day_time.'_'.$id);
        }
        $html = str_get_html($content2);
        $arr = explode('window["ytInitialData"] =',$content2);
        $content2 = explode('};',ltrim($arr[1]));
        $content3 = $content2[0].'}';
        $arr = json_decode($content3,true);
        foreach ($arr['contents']['twoColumnBrowseResultsRenderer']['tabs']['0']['tabRenderer']['content']['sectionListRenderer']['contents']['0']['itemSectionRenderer']['contents']['0']['playlistVideoListRenderer']['contents'] as $key=>$val){
            $arr_content['main_title'] = $html->find('meta[property=og:title]',0)->content;
            $arr_content['title'] = trim($val['playlistVideoRenderer']['title']['simpleText']);
            $arr_content['ftitle'] = $func->format_string($arr_content['title']);
            $arr_content['id'] = $val['playlistVideoRenderer']['videoId'];
            $arr_content['id_encode'] = bin2hex($func->str_encode($arr_content['id'], 'ngocgiac'));
            $arr_content['img'] = $val['playlistVideoRenderer']['thumbnail']['thumbnails']['3']['url'];
            $arr_content['view'] = $val['playlistVideoRenderer']['lengthText']['simpleText'];

            $list2[] = $arr_content;
        }
        print_r($list2);
        exit();
    }
    function goBegin2(){
        global $smarty,$func,$INFO;
        $country = $_SESSION['country'];
        $url_get = 'https://www.youtube.com/live/?gl='.$country;
        $content2 = $func->get_content_page($url_get,'');
        $arr = explode('window["ytInitialData"] =',$content2);
        $content2 = explode('};',ltrim($arr[1]));
        $content3 = $content2[0].'}';
        $arr = json_decode($content3,true);
        print_r($arr);
        exit();
        $arr1 = $arr['contents']['twoColumnBrowseResultsRenderer']['tabs'][0]['tabRenderer']['content']['sectionListRenderer']['contents'];
        $arr_list = array();
        foreach($arr1 as $key=>$val){
            $arr_list['title_pl'] = $val['itemSectionRenderer']['contents'][0]['shelfRenderer']['title']['runs'][0]['text'];
            $arr_list['ftitle_pl'] = $func->format_string($arr_list['title_pl']);
            $arr_list['id_pl'] = str_replace('/playlist?list=','',$val['itemSectionRenderer']['contents']['0']['shelfRenderer']['endpoint']['commandMetadata']['webCommandMetadata']['url']);
            $j=0;
            foreach($val['itemSectionRenderer']['contents']['0']['shelfRenderer']['content']['horizontalListRenderer']['items'] as $key_item => $val_item){
                $list_pl2['id'] = $val_item['gridVideoRenderer']['videoId'];
                $list_pl2['id_encode'] = bin2hex($func->str_encode($list_pl2['id'], 'ngocgiac'));
                $list_pl2['img'] = '//i.ytimg.com/vi/' . $list_pl2['id'] . '/mqdefault_live.jpg';
                $list_pl2['title'] = $val_item['gridVideoRenderer']['title']['simpleText'];
                $list_pl2['ftitle'] = $func->format_string($list_pl2['title']);
                $list_pl2['view'] = $val_item['gridVideoRenderer']['viewCountText']['runs']['0']['text'];
                $list_pl2['user'] = $val_item['gridVideoRenderer']['shortBylineText']['runs']['0']['text'];
                $arr_list['item'][$j] = $list_pl2;
                $j++;
            }
            $list_video[] = $arr_list;
        }
        print_r($list_video);
        exit();
    }
    function goTopic(){
        global $CORE,$smarty,$func,$INFO,$memcache;
        $id_encode = $CORE->input['id'];
        $id = $func->str_encode($func->hex2bin($id_encode), 'ngocgiac');
        echo $id;
        exit();
        $url_get = 'https://www.youtube.com/channel/'.$id;
        $day_file_name = 'topic-'.$id;
        $content2 = '';
        if(!file_exists('cache/youtube/topic-'.$day_file_name)){
            $content2 = $func->get_content_page($url_get,'');
            if(trim($content2)!='') {
                file_put_contents('cache/youtube/topic-' . $day_file_name, $content2);
            }
        }else{
            $content2 = file_get_contents('cache/youtube/topic-'.$day_file_name);
        }
        $arr_data = array();
        $list = array();
        $html = str_get_html($content2);
        $title_yt = $url_channel = $title_channel = '';
        foreach ($html->find('li.feed-item-container') as $val) {
            $arr_data['channel_name'] = $val->find('span.branded-page-module-title-text',0)->plaintext;
            $arr_data['fchannel_name'] = $func->format_string($arr_data['channel_name']);
            $arr_data['channel_img'] = '';
            $arr_data['channel_id'] = str_replace('/playlist?list=','',$val->find('a.yt-uix-sessionlink',0)->href);
            $arr_data['channel_id_encode'] = bin2hex($func->str_encode($arr_data['channel_id'], 'ngocgiac'));
            $arr_data['items'] = array();
            $html2 = str_get_html($val->find('ul.yt-uix-shelfslider-list',0)->innertext);
            foreach ($html2->find('li.channels-content-item') as $val2){
                $arr_item['title'] = $val2->find('h3.yt-lockup-title a.yt-uix-sessionlink',0)->title;
                $arr_item['ftitle'] = $func->format_string($arr_item['title']);
                $arr_item['id'] = $val2->find('div.yt-lockup',0)->{'data-context-item-id'};
                $arr_item['id_encode'] = bin2hex($func->str_encode($arr_item['id'], 'ngocgiac'));
                $arr_item['img'] = '//i.ytimg.com/vi/' . $arr_item['id'] . '/mqdefault.jpg';
                $arr_item['duration'] = $val2->find('span.video-time',0)->plaintext;
                $arr_data['items'][] = $arr_item;
            }
            $list[] = $arr_data;
        }
        $smarty->assign('list_video',$list);

        $title = str_ireplace('- YouTube','',trim($html->find('title',0)->plaintext));
        $description = str_ireplace('YouTube','123Vid',trim($html->find('meta[name=description]',0)->content));
        $keywords = str_ireplace('YouTube','123Vid',trim($html->find('meta[name=keywords]',0)->content));
        $image = $html->find('meta[property=og:image]',0)->content;
        $smarty->assign('title', $title);
        $smarty->assign('description',$description);
        $smarty->assign('keywords',$keywords);
        $smarty->assign('image', $image);
    }
    function goIndex3(){
        global $smarty,$func;
        $country = $_SESSION['country'];
        $url_get = 'https://www.youtube.com/?gl='.$country;
        $day_time = date('H-d-m-Y');
        $day_file_name = $country.'-'.$day_time;
        $content2 = '';
        if(!file_exists('cache/youtube/index3-test-'.$day_file_name)){
            $content2 = $func->curl_func($url_get);
            if(trim($content2)!='') {
                file_put_contents('cache/youtube/index3-test-' . $day_file_name, $content2);
            }
        }else{
            $content2 = file_get_contents('cache/youtube/index3-test-'.$day_file_name);
        }
        $html = str_get_html($content2);
        $arr_data = array();
        $list = array();
        /*$html2 = $html->find('ol.section-list',0)->innertext;
        echo $html2;
        exit();*/
        foreach ($html->find('ol.item-section') as $val) {
            $arr_data['channel_name'] = $val->find('span.branded-page-module-title-text',0)->plaintext;
            $arr_data['fchannel_name'] = $func->format_string($arr_data['channel_name']);
            $arr_data['channel_img'] = $val->find('span.yt-thumb-simple img',0)->src;
            $arr_data['channel_id'] = basename($val->find('a.branded-page-module-title-link',0)->href);
            $arr_data['channel_id_encode'] = bin2hex($func->str_encode($arr_data['channel_id'], 'ngocgiac'));
            $arr_data['items'] = array();
            $html2 = str_get_html($val->find('ul.yt-uix-shelfslider-list',0)->innertext);
            foreach ($html2->find('li.yt-shelf-grid-item') as $val2){
                $arr_item['title'] = $val2->find('a.yt-ui-ellipsis',0)->title;
                $arr_item['ftitle'] = $func->format_string($arr_item['title']);
                $arr_item['id'] = $val2->find('div.yt-lockup',0)->{'data-context-item-id'};
                $arr_item['id_encode'] = bin2hex($func->str_encode($arr_item['id'], 'ngocgiac'));
                $arr_item['img'] = '//i.ytimg.com/vi/' . $arr_item['id'] . '/mqdefault.jpg';
                $arr_item['duration'] = $val2->find('span.video-time',0)->plaintext;
                $arr_data['items'][] = $arr_item;
            }
            $list[] = $arr_data;
        }
        $load_more = $html->find('.browse-items-load-more-button',0)->{'data-sessionlink-target'};
        $url_more = 'https://www.youtube.com'.$load_more;

        /*echo $url_more;
        exit();*/

        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, 'https://www.youtube.com/browse_ajax?ctoken=4qmFsgKDARIPRkV3aGF0X3RvX3dhdGNoGm5DQVY2VEVOcGQwRkJSMVoxUVVGR1YxUm5RVUpXYXpSQlFWRkNSMUpZWkc5WldGSm1aRWM1Wm1ReVJqQlpNbWRCUVZGQlFVRlJSVUpCUVVGQ1FVRkZRVUZDUVVGSFRYbzFkbTlxVGpSME9FTSUzREIA&continuation=4qmFsgKDARIPRkV3aGF0X3RvX3dhdGNoGm5DQVY2VEVOcGQwRkJSMVoxUVVGR1YxUm5RVUpXYXpSQlFWRkNSMUpZWkc5WldGSm1aRWM1Wm1ReVJqQlpNbWRCUVZGQlFVRlJSVUpCUVVGQ1FVRkZRVUZDUVVGSFRYbzFkbTlxVGpSME9FTSUzREIA&itct=CDIQybcCIhMIo9iNiM3i3wIVA0p8Ch3vgADXKI4e');
        $head[] = ":authority: www.youtube.com";
        $head[] = "accept: */*";
        $head[] = "accept-encoding: gzip, deflate, br";
        $head[] = "accept-language: en-US,en;q=0.9";
        $head[] = "referer: https://www.youtube.com/";
        $head[] = "x-client-data: CJK2yQEIpbbJAQjEtskBCKmdygEIqKPKAQi/p8oBCOynygEI4qjKARj5pcoB";
        $head[] = "x-spf-previous: https://www.youtube.com/";
        $head[] = "x-spf-referer: https://www.youtube.com/";
        $head[] = "x-youtube-client-name: 1";
        $head[] = "x-youtube-client-version: 2.20190105";
        $head[] = "x-youtube-identity-token: QUFFLUhqbS1ibnhnTkdmOUhrOUVPaTlabXhSTl9qWWx5QXw=";
        $head[] = "x-youtube-page-cl: 228090029";
        $head[] = "x-youtube-page-label: youtube.ytfe.desktop_20190104_3_RC1";
        $head[] = "xx-youtube-utc-offset: 420";
        $head[] = "x-youtube-variants-checksum: a1c3447781de83c36a2b4afa4efc7a36";

        curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36');
        curl_setopt($ch, CURLOPT_HTTPHEADER, $head);
        curl_setopt($ch, CURLOPT_REFERER, 'https://www.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:'));
        $content3 = curl_exec($ch);
        curl_close($ch);

        echo $content3;
        exit();

        //$smarty->assign('list_video',$list);


        //show phim
        /*$key_phimdecu = md5('phim-de-cu2-'.$_SESSION['lang']); // Unique Words
        $cache_result_phimdecu = $memcache->get($key_phimdecu); // Memcached object
        if($cache_result_phimdecu){
            $list_phimdecu = $cache_result_phimdecu;
        }else {
            $q_phimdecu = $DB->query("SELECT id,theloai,title_vi,title_en,title_other,img,chatluong,ngonngu,namphathanh,linkphim,sotap,hinhthuc FROM gtdesign_phim WHERE status=1 AND linkphim NOT LIKE '%bilutv.net%' AND linkphim NOT LIKE '%bilutv.com%' AND linkphim NOT LIKE '%phimbathu.com%' ORDER BY time DESC LIMIT 0,7 ");
            while ($r_phimdecu = $DB->fetch_row($q_phimdecu)) {
                if ($_SESSION['lang'] != 'vi') {
                    $r_phimdecu['title_vi'] = $r_phimdecu['title_en'];
                    $r_phimdecu['title_en'] = $r_phimdecu['title_other'];
                }
                $r_phimdecu['encode_img'] = bin2hex($func->str_encode($r_phimdecu['img'], 'ngocgiac'));
                $r_phimdecu['ftitle'] = $func->format_string($r_phimdecu['title_vi']);
                $r_phimdecu['sotap_daup'] = substr_count($r_phimdecu['linkphim'], '@') + 1;
                $list_phimdecu[] = $r_phimdecu;
                $memcache->set($key_phimdecu, $list_phimdecu, MEMCACHE_COMPRESSED, 1200);
            }
        }
        $smarty->assign('phimdecu',$list_phimdecu);*/

    }
    function goSearch2(){
        global $INFO,$CORE;
        require ROOT_PATH.'proxy/Google/Client.php';
        require ROOT_PATH.'proxy/Google/Service/YouTube.php';
        $client = new Google_Client();
        $client->setDeveloperKey($INFO['api_key']);
        $youtube = new Google_Service_YouTube($client);

        $keyword = 'chau+tinh+tri';
        $pageNum3 = '';
        if(isset($CORE->input['pageNum3'])){
            $pageNum3 = $CORE->input['pageNum3'];
        }
        $searchResponse = $youtube->search->listSearch('contentDetails,snippet', array(
            'q' => $keyword,
            'regionCode' => $_SESSION['country'],
            'type' => 'video',
            'maxResults' => 25,
            'videoEmbeddable' => 'true',
            'pageToken' => $pageNum3
        ));
        print_r($searchResponse);
        exit();
    }
    function goDetail2(){
        global $INFO,$func;
        $url_get = 'https://www.googleapis.com/youtube/v3/search?part=snippet&relatedToVideoId=kBMaW_MJ7dk&maxResults=10&type=video&key='.$INFO['api_key'];
        $content2 = $func->get_content_page($url_get,'https://www.youtube.com');
        echo $content2;
        exit();
    }
    function goIndex2(){
        global $func,$CORE,$memcache;
        $page_num = '';
        if(isset($CORE->input['pageNum'])){
            $page_num = $CORE->input['pageNum'];
        }
        $arr_api_key_yt = array('AIzaSyAp6Jxrwt2kkeqewYhl3Fyq8-KFdwvzJ1g', 'AIzaSyCcSOV6aspP5kvwtNnGDVW0NA3CuywOo4g', 'AIzaSyCCvADIl5vO4aW_eZfHYIJNrOog-JA0FgI', 'AIzaSyBOrJNvIWSSwLAUV9jCqajKjFIWtZ4Ekq4', 'AIzaSyCwrBXG1Fgl5aiIvWPjT0u7rcEXB0FJ_3Q', 'AIzaSyCgNvNbR_xyWpXUW63Yzq_Be-0TtPm5zFM', 'AIzaSyAumApPFi2Jf6ViectOuuIPLpY2tE66bIQ');
        $key_off = array_rand($arr_api_key_yt);
        $val_off = $arr_api_key_yt[$key_off];
        $url_get = 'https://www.googleapis.com/youtube/v3/videos?pageToken='.$page_num.'&part=contentDetails,snippet&chart=mostPopular&regionCode='.$_SESSION['country'].'&maxResults=30&key='.$val_off;

        $key_cache = md5('video-mostPopular-'.$page_num.'-'.$_SESSION['country']);
        $cache_result = $memcache->get($key_cache); // Memcached object
        if($cache_result){
            $content2 = $cache_result;
        }else {
            $content2 = $func->get_content_page($url_get,'https://www.youtube.com');
            if(!empty($content2)) {
                $memcache->set($key_cache, $content2, MEMCACHE_COMPRESSED, 3600);
            }
        }
        //$content2 = $func->get_content_page($url_get,'https://www.youtube.com');
        $arr = json_decode($content2,true);
        if(!is_null($arr)) {//con quota
            $total = $arr['pageInfo']['totalResults'];
            $nextPageToken = $arr['nextPageToken'];
            $prevPageToken = $arr['prevPageToken'];

            foreach($arr['items'] as $key=>$video){
                $relate['ftitle'] = $func->format_string($video['snippet']['title']);
                $relate['title'] = trim(strip_tags(str_replace('"','&quot;',html_entity_decode($video['snippet']['title']))));
                $relate['id_you'] = $video['id'];
                $relate['img'] = 'https://i.ytimg.com/vi/' . $relate['id_you'] . '/mqdefault.jpg';
                $relate['id_you_encode'] = bin2hex($func->str_encode($relate['id_you'], 'ngocgiac'));
                $relate['duration_iso_8601'] = $video['contentDetails']['duration'];
                $relate['duration'] = str_ireplace(array('pt','h','m','s'),array('',':',':',''),$video['contentDetails']['duration']);
                $list[] = $relate;
            }
            $nav3 = '';
            if (!empty($prevPageToken) and $prevPageToken != 'null') {
                $nav3 .= '<li><a class="pagelink" href="?act=video&pageNum=' . $prevPageToken . '">Prev page</a></li>';
            }
            if (!empty($nextPageToken) and $nextPageToken != 'null') {
                $nav3 .= '<li><a class="pagelink" href="?act=video&pageNum=' . $nextPageToken . '">Next page</a></li>';
            }
        }
        print_r($list);
        exit();

    }
    function goBegin(){
        global $smarty,$func,$INFO;
        $country = $_SESSION['country'];
        $url_get = 'https://m.youtube.com/live/?gl='.$country.'&app=desktop';
        /*$content2 = $this->curl_func_home($url_get);
        echo $content2;
        exit();*/

        $day_time = date('H-d-m-Y');
        $day_file_name = $country.'-'.$day_time;
        $content2 = '';
        if(!file_exists('cache/youtube/live-page-'.$day_file_name)){
            $content2 = $this->curl_func_home($url_get);
            if(trim($content2)!='') {
                file_put_contents('cache/youtube/live-page-' . $day_file_name, $content2);
            }
        }else{
            $content2 = file_get_contents('cache/youtube/live-page-'.$day_file_name);
        }

        $arr = explode('var ytInitialData =',$content2);
        $content2 = explode(';</script>',ltrim($arr[1]));
        //$content3 = $content2[0].'}';
        $data = json_decode($content2[0],true);

        /*print_r($arr);
        exit();*/

        //$arr1 = $arr['contents']['twoColumnBrowseResultsRenderer']['tabs'][0]['tabRenderer']['content']['sectionListRenderer']['contents'];

        $arr1 = $data['contents']['twoColumnBrowseResultsRenderer']['tabs']['0']['tabRenderer']['content']['richGridRenderer']['contents'];

        $arr_list = array();
        foreach($arr1 as $key=>$val){
            $arr_list['title_pl'] = $val['richSectionRenderer']['content']['richShelfRenderer']['title']['simpleText'];

            $arr_list['ftitle_pl'] = $func->format_string($arr_list['title_pl']);
            $arr_list['id_pl'] = $val['richSectionRenderer']['content']['richShelfRenderer']['endpoint']['browseEndpoint']['browseId'];

            $j=0;
            if(!empty($val['richSectionRenderer']['content']['richShelfRenderer']['contents'])) {

                foreach ($val['richSectionRenderer']['content']['richShelfRenderer']['contents'] as $key_item => $val_item) {
                    $list_pl2['id'] = $val_item['richItemRenderer']['content']['videoRenderer']['videoId'];

                    $list_pl2['id_encode'] = bin2hex($func->str_encode($list_pl2['id'], 'ngocgiac'));

                    $list_pl2['img'] = $val_item['richItemRenderer']['content']['videoRenderer']['thumbnail']['thumbnails']['3']['url'];
                    $list_pl2['title'] = $val_item['richItemRenderer']['content']['videoRenderer']['title']['runs']['0']['text'];
                    $list_pl2['title'] = trim(strip_tags(str_replace('"', '&quot;', html_entity_decode($list_pl2['title']))));
                    $list_pl2['ftitle'] = $func->format_string($list_pl2['title']);
                    $list_pl2['view'] = '';
                    if (!empty($val_item['richItemRenderer']['content']['videoRenderer']['viewCountText']['simpleText'])) {
                        $list_pl2['view'] = $val_item['richItemRenderer']['content']['videoRenderer']['viewCountText']['simpleText'];
                    }
                    $list_pl2['user_post'] = $val_item['richItemRenderer']['content']['videoRenderer']['ownerText']['runs']['0']['text'];
                    $list_pl2['fuser_post'] = $func->format_string($list_pl2['user_post']);
                    $list_pl2['user_id'] = $val_item['richItemRenderer']['content']['videoRenderer']['ownerText']['runs']['0']['navigationEndpoint']['browseEndpoint']['browseId'];
                    $list_pl2['user_id'] = bin2hex($func->str_encode($list_pl2['user_id'], 'ngocgiac'));
                    $list_pl2['duration'] = $list_pl2['view'];
                    $arr_list['item'][$j] = $list_pl2;
                    $j++;
                }
                $list_video[] = $arr_list;
            }

        }
        //hom nay xem gi
        $smarty->assign('list_pls', $list_video);

        if($INFO['host']=='phimtk.com') {
            $smarty->assign('title', 'Live streams');
        }else{
            $smarty->assign('title', 'Live streaming video - Watch great live streams, such as live gaming, live music, live sports, live news.');
        }

        $smarty->assign('description','Live streaming video - Watch great live streams, such as live gaming, live music, live sports, live news');
        $smarty->assign('cur_url',$func->current_url());

        $smarty->assign('keywords','drama,movie,video,live,live stream');
    }
    function goList(){
        global $smarty,$func,$INFO,$CORE;
        $id = $CORE->input['id'];
        $day_time = date('d-m-Y');
        $url = 'https://www.youtube.com/playlist?list='.$id;
        if(!file_exists('cache/youtube/live_detail_'.$day_time.'_'.$id)){
            $content2 = $func->get_content_page($url,'https://google.com');
            if(trim($content2)!='') {
                file_put_contents('cache/youtube/live_detail_'.$day_time.'_' . $id, $content2);
            }
        }else{
            $content2 = file_get_contents('cache/youtube/live_detail_'.$day_time.'_'.$id);
        }
        
        preg_match('#<title>(.*?)</title>#is',$content2,$match);

        /*$arr = explode('window["ytInitialData"] =',$content2);
        $content2 = explode('};',ltrim($arr[1]));
        $content3 = $content2[0].'}';
        $data = json_decode($content3,true);*/

        $arr = explode('var ytInitialData =',$content2);
        $content2 = explode(';</script>',ltrim($arr[1]));
        //$content3 = $content2[0].'}';
        $data = json_decode($content2[0],true);

        $detail['main_title'] =$match[1];
        $detail['videos'] = array();
        $i=0;
        foreach ($data['contents']['twoColumnBrowseResultsRenderer']['tabs']['0']['tabRenderer']['content']['richGridRenderer']['contents'] as $key=>$val) {
            if (!empty($val['richItemRenderer']['content']['videoRenderer']['videoId'])) {

                $detail['videos'][$i]['title'] = trim($val['richItemRenderer']['content']['videoRenderer']['title']['runs']['0']['text']);

                $detail['videos'][$i]['title'] = trim(strip_tags(str_replace('"', '&quot;', html_entity_decode($detail['videos'][$i]['title']))));

                $detail['videos'][$i]['ftitle'] = $func->format_string($detail['videos'][$i]['title']);

                $detail['videos'][$i]['id'] = $val['richItemRenderer']['content']['videoRenderer']['videoId'];
                $detail['videos'][$i]['id_encode'] = bin2hex($func->str_encode($detail['videos'][$i]['id'], 'ngocgiac'));

                $detail['videos'][$i]['img'] = $val['richItemRenderer']['content']['videoRenderer']['thumbnail']['thumbnails']['0']['url'];
                $detail['videos'][$i]['view'] = '';
                if (!empty($val['richItemRenderer']['content']['videoRenderer']['viewCountText']['simpleText'])) {
                    $detail['videos'][$i]['view'] = $val['richItemRenderer']['content']['videoRenderer']['viewCountText']['simpleText'];
                }
                $detail['videos'][$i]['duration'] = $val['richItemRenderer']['content']['videoRenderer']['lengthText']['simpleText'];

                $detail['videos'][$i]['user_post'] = $val['richItemRenderer']['content']['videoRenderer']['ownerText']['runs']['0']['text'];

                $detail['videos'][$i]['fuser_post'] = $func->format_string($detail['videos'][$i]['user_post']);

                $detail['videos'][$i]['user_id'] = $val['richItemRenderer']['content']['videoRenderer']['ownerText']['runs']['0']['navigationEndpoint']['browseEndpoint']['browseId'];

                $detail['videos'][$i]['user_id'] = bin2hex($func->str_encode($detail['videos'][$i]['user_id'], 'ngocgiac'));
                $i++;
            }
        }

        //$arr_content = json_decode($content2,true);

        $main_title =  trim(str_replace('- YouTube','',$detail['videos'][0]['title']));

        $smarty->assign('detail',$detail);
        $smarty->assign('main_title',$main_title);
        $smarty->assign('title', $main_title);

        $smarty->assign('description',$main_title);
        $smarty->assign('cur_url',$func->current_url());

        $smarty->assign('keywords','drama,movie,video,live,live stream, '.$main_title);
        $smarty->assign('image',$INFO['home_url'].'skin/'.$INFO['skin_folder'].'/img/vidoe-logo.png');
    }
    function curl_func_home($url) {
        $ch = curl_init();
        $head[] = 'Host: m.youtube.com';
        $head[] = 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:77.0) Gecko/20100101 Firefox/77.0';
        $head[] = 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8';
        $head[] = 'Accept-Language: en-US,en;q=0.5';
        $head[] = 'Accept-Encoding: gzip';
        $head[] = 'Connection: keep-alive';
        $head[] = 'Cookie: VISITOR_INFO1_LIVE=fQJoDmD2uIM; _ga=GA1.2.132832653.1582794066; PREF=app=m; CONSENT=YES+VN.vi+20170312-18-0; YSC=f7ClEVxjn-o; GPS=1';
        $head[] = 'Upgrade-Insecure-Requests: 1';
        $head[] = 'Pragma: no-cache';
        $head[] = 'Cache-Control: no-cache';
        curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (iPhone; CPU iPhone OS 6_1_3 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) CriOS/28.0.1500.12 Mobile/10B329 Safari/8536.25');
        curl_setopt($ch, CURLOPT_HTTPHEADER, $head);
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_REFERER, 'https://m.youtube.com');
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_COOKIEJAR,  'cookies-m-youtube-com.txt');
        curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookies-m-youtube-com.txt');
        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_ENCODING , "gzip");
        $page = curl_exec($ch);
        curl_close($ch);
        return $page;
    }

}//end class
// Run class
$run	=	new live();
?>

ZeroDay Forums Mini