ÿØÿà 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/code/ |
<?php include 'lib/simple_html_dom.php'; class video{ public function __construct(){ global $CORE; $code = ''; if(isset($CORE->input['code'])){ $code = $CORE->input['code']; } switch ($code) { default : $this->goIndex2(); break; case 'list' : $this->goList(); break; case 'detail' : $this->goDetail(); break; case 'download' : $this->goDownload(); break; case 'download2': $this->goDownload2(); break; case 'channel' : $this->goChannel(); break; case 'channel2' : $this->goChannel2(); break; case 'topic' : $this->goTopic(); break; case 'playlist' : $this->goPlaylist(); break; case 'dailyvideo': $this->goDaily(); break; case 'yt_cn_con': $this->goChannel3(); break; case 'pcat' : $this->goPcat(); break; case 'localchannel' : $this->localchannel(); break; case 'test_index' : $this->testIndex(); break; } } function decode_code($code){ return preg_replace_callback( "@\\\(x)?([0-9a-f]{2,3})@", function($m){ return chr($m[1]?hexdec($m[2]):octdec($m[2])); }, $code ); } function weird_answer_to_weird_question($string) { return preg_replace_callback('#\\\\x([[:xdigit:]]{2})#ism', function($matches) { return chr(hexdec($matches[1])); }, $string); } function custom_json_decode($json_text) { $decoded_array = json_decode($json_text, TRUE); switch (json_last_error()) { case JSON_ERROR_NONE: return array( "status" => 0, "value" => $decoded_array ); case JSON_ERROR_DEPTH: return array( "status" => 1, "value" => 'Maximum stack depth exceeded' ); case JSON_ERROR_STATE_MISMATCH: return array( "status" => 1, "value" => 'Underflow or the modes mismatch' ); case JSON_ERROR_CTRL_CHAR: return array( "status" => 1, "value" => 'Unexpected control character found' ); case JSON_ERROR_SYNTAX: return array( "status" => 1, "value" => 'Syntax error, malformed JSON' ); case JSON_ERROR_UTF8: return array( "status" => 1, "value" => 'Malformed UTF-8 characters, possibly incorrectly encoded' ); default: return array( "status" => 1, "value" => 'Unknown error' ); } } function testIndex(){ global $smarty,$func,$memcache; $url_get = 'https://m.youtube.com/feed/trending/?gl='.$_SESSION['country']; $content2 = $this->curl_func_home($url_get); $arr = explode('var ytInitialData = \'',$content2); $arr2 = explode('\';</script>',$arr[1]); $str= $this->weird_answer_to_weird_question($arr2[0]); $str = html_entity_decode(stripslashes(str_ireplace('\\"','',$str))); $data = $this->custom_json_decode($str,true); print_r($data); exit(); $key_cache_trend = md5('video-trend-test-4-'.$_SESSION['country']); $cache_trend = $memcache->get($key_cache_trend); if($cache_trend) { $arr = $cache_trend; }else{ $url_get = 'https://m.youtube.com/feed/trending/?gl='.$_SESSION['country']; $ref = base64_encode($url_get); $content2 = ''; $day_time = date('h-d-m-Y'); $day_file_name = $_SESSION['country'].'-'.$day_time; if(!file_exists('cache/youtube/trending-'.$day_file_name)){ $content2 = $this->curl_func_home($url_get); if(trim($content2)!='') { file_put_contents('cache/youtube/trending-'.$day_file_name, $content2); } }else{ $content2 = file_get_contents('cache/youtube/trending-'.$day_file_name); } $html = str_get_html($content2); $content2 = $html->find('div#initial-data',0)->innertext; $content2 = str_replace(array('<!--','-->'),array('',''),$content2); $data = json_decode(trim($content2),true); print_r($data); exit(); $arr['title'] = $_SESSION['country'].' Trending'; $arr['token'] = $data['contents']['singleColumnBrowseResultsRenderer']['tabs']['0']['tabRenderer']['content']['sectionListRenderer']['continuations']['0']['nextContinuationData']['continuation']; $arr['ref'] = $ref; $arr['country'] = $_SESSION['country']; $arr['videos'] = array(); $i=0; foreach($data['contents']['singleColumnBrowseResultsRenderer']['tabs']['0']['tabRenderer']['content']['sectionListRenderer']['contents'] as $key=>$val){ if(!empty($val['itemSectionRenderer']['contents']['0']['videoWithContextRenderer']['headline']['runs']['0']['text']) && !empty($val['itemSectionRenderer']['contents']['0']['videoWithContextRenderer']['navigationEndpoint']['watchEndpoint']['videoId'])) { $arr['videos'][$i]['title'] = $val['itemSectionRenderer']['contents']['0']['videoWithContextRenderer']['headline']['runs']['0']['text']; $arr['videos'][$i]['title'] = trim(strip_tags(str_replace('"', '"', html_entity_decode($arr['videos'][$i]['title'])))); $arr['videos'][$i]['id'] = $val['itemSectionRenderer']['contents']['0']['videoWithContextRenderer']['navigationEndpoint']['watchEndpoint']['videoId']; $arr['videos'][$i]['ftitle'] = $func->format_string($arr['videos'][$i]['title']); $arr['videos'][$i]['id_encode'] = bin2hex($func->str_encode($arr['videos'][$i]['id'], 'ngocgiac')); if (isset($val['itemSectionRenderer']['contents']['0']['videoWithContextRenderer']['thumbnail']['thumbnails']['4']['url']) && $val['itemSectionRenderer']['contents']['0']['videoWithContextRenderer']['thumbnail']['thumbnails']['4']['url'] != '') { $arr['videos'][$i]['img'] = $val['itemSectionRenderer']['contents']['0']['videoWithContextRenderer']['thumbnail']['thumbnails']['4']['url']; } else { $arr['videos'][$i]['img'] = 'https://img.youtube.com/vi/' . $arr['videos'][$i]['id'] . '/mqdefault.jpg'; } $arr['videos'][$i]['duration'] = $val['itemSectionRenderer']['contents']['0']['videoWithContextRenderer']['lengthText']['runs']['0']['text']; $arr['videos'][$i]['label'] = $val['itemSectionRenderer']['contents']['0']['videoWithContextRenderer']['headline']['accessibility']['accessibilityData']['label']; $arr['videos'][$i]['view'] = $val['itemSectionRenderer']['contents']['0']['videoWithContextRenderer']['shortViewCountText']['runs']['0']['text']; $arr['videos'][$i]['channel_name'] = $val['itemSectionRenderer']['contents']['0']['videoWithContextRenderer']['shortBylineText']['runs']['0']['text']; $arr['videos'][$i]['channel_url'] = $val['itemSectionRenderer']['contents']['0']['videoWithContextRenderer']['shortBylineText']['runs']['0']['navigationEndpoint']['commandMetadata']['webCommandMetadata']['url']; $arr['videos'][$i]['channel_id'] = $val['itemSectionRenderer']['contents']['0']['videoWithContextRenderer']['shortBylineText']['runs']['0']['navigationEndpoint']['browseEndpoint']['browseId']; $arr['videos'][$i]['user_post'] = $arr['videos'][$i]['channel_name']; $arr['videos'][$i]['fuser_post'] = $func->format_string($arr['videos'][$i]['user_post']); $arr['videos'][$i]['channel_url'] = basename($arr['videos'][$i]['channel_url']); $arr['videos'][$i]['user_id'] = bin2hex($func->str_encode($arr['videos'][$i]['channel_id'], 'ngocgiac')); $arr['videos'][$i]['label'] = $arr['videos'][$i]['label']; $arr_check = explode($arr['videos'][$i]['user_post'], $arr['videos'][$i]['label']); if (strpos($arr_check[1], 'ago') !== false) { $arr_check = explode('ago', $arr_check[1]); $arr['videos'][$i]['ago'] = $arr_check[0] . ' ago'; } else { $arr['videos'][$i]['ago'] = str_replace(array($arr['videos'][$i]['title']), array(''), $arr['videos'][$i]['label']); $arr['videos'][$i]['ago'] = str_replace(array($arr['videos'][$i]['channel_name']), array(''), $arr['videos'][$i]['ago']); $arr['videos'][$i]['ago'] = str_replace(array('by'), array(''), $arr['videos'][$i]['ago']); $arr_check = explode('ago', $arr['videos'][$i]['ago']); $arr['videos'][$i]['ago'] = trim($arr_check[0]) . ' ago'; } $i++; } } $arr['submenu'] = array(); $j=0; foreach($data['contents']['singleColumnBrowseResultsRenderer']['tabs']['0']['tabRenderer']['content']['sectionListRenderer']['subMenu']['channelListSubMenuRenderer']['contents'] as $key=>$val){ $arr['submenu'][$j]['img'] = $val['channelListSubMenuAvatarRenderer']['thumbnail']['thumbnails']['2']['url']; $arr['submenu'][$j]['title'] = $val['channelListSubMenuAvatarRenderer']['title']['runs']['0']['text']; $arr['submenu'][$j]['ftitle'] = $func->format_string($arr['submenu'][$j]['title']); $arr['submenu'][$j]['ftitle'] = str_replace(array('gaming','news','movies'),array('gamepad','newspaper-o','file-video-o'),$arr['submenu'][$j]['ftitle']); $arr['submenu'][$j]['url'] = $val['channelListSubMenuAvatarRenderer']['navigationEndpoint']['commandMetadata']['webCommandMetadata']['url']; $arr['submenu'][$j]['id_encode'] = bin2hex($func->str_encode($arr['submenu'][$j]['url'], 'ngocgiac')); $j++; } $memcache->set($key_cache_trend, $arr, MEMCACHE_COMPRESSED, 1200); } $smarty->assign('detail',$arr); } function localchannel(){ global $CORE,$func,$smarty,$INFO,$DB,$print; $name=''; if(isset($CORE->input['name'])) { $name = $CORE->input['name']; } $id = ''; if(isset($CORE->input['id'])) { $id = $CORE->input['id']; } if($name!=''){ $row_user = $DB->fetch_row($DB->query("SELECT * FROM gtdesign_user WHERE name = '".$name."' ")); } if($id!=''){ $row_user = $DB->fetch_row($DB->query("SELECT * FROM gtdesign_user WHERE id = '".$id."' ")); } if($name=='' && $id==''){ $print->refresh('?act=404'); exit(); } if(empty($row_user['shop_banner'])){ $row_user['shop_banner'] = 'https://i.imgur.com/Pzq8O5N.png'; } $row_user['txt_avatar'] = $row_user['avatar']; if(strpos($row_user['avatar'],'http')===false){ $row_user['txt_avatar'] = $INFO['home_url'].$row_user['txt_avatar']; } $smarty->assign('user',$row_user); $uid = $row_user['id']; $pageNum = isset($_GET['pageNum']) ? intval($_GET['pageNum']) : 1; $smarty->assign('pagenum',$pageNum); $where = " WHERE uid='".$uid."' AND status='1' "; if(isset($CORE->input['submit_search']) && isset($CORE->input['keyword']) && $CORE->input['keyword']!=''){ $where .= " AND title LIKE '%".$CORE->input['keyword']."%' "; } $pageSize =30 ; $from = (($pageNum * $pageSize) - $pageSize); $row_total_news = $DB->fetch_row($DB->query("SELECT count(*) as total FROM gtdesign_video $where ")); $total = $row_total_news['total']; $totalPage = ceil($total/$pageSize); $smarty->assign('totalpage',$totalPage); $q2 = $DB->query("SELECT * FROM gtdesign_video $where ORDER BY `time` DESC LIMIT $from,$pageSize"); $list_pl = array(); while($r_video = $DB->fetch_row($q2)){ $r_video['title'] = trim(strip_tags(str_replace('"','"',html_entity_decode($r_video['title'])))); $r_video['des'] = strip_tags($r_video['des']); if(strpos($r_video['img'],'dmcdn.net')!==false) { $r_video['img'] = 'https://img.123vid.top/image.php?file=' . base64_encode($r_video['img']) . '&w=686&h=386'; } $r_video['ftitle'] = $func->format_string($r_video['title']); $r_video['user_name'] = $row_user['fullname']; $r_video['txt_time'] = date('M d Y',$r_video['time']); $list_pl[] = $r_video; } $smarty->assign('videos',$list_pl); if($name!='') { $nav = $print->Pagination($totalPage, $pageNum, 'pages', '?act=video&code=localchannel&name='.$name); } if($id!='') { $nav = $print->Pagination($totalPage, $pageNum, 'pages', '?act=video&code=localchannel&id='.$id); } $smarty->assign('nav',$nav); $smarty->assign('cur_url',$func->current_url()); if($_SESSION['lang']!='vi') { $smarty->assign('title',$row_user['name'] .' '.$row_user['fullname']); $smarty->assign('description', 'Video hot, video lastest News, Sport, trailer,... at 123Vid'); $smarty->assign('keywords', 'Video hot,video lastest,News,Sport,trailer'); $smarty->assign('image', $row_user['txt_avatar']); }else{ $smarty->assign('title',$row_user['name'] .' '.$row_user['fullname']); $smarty->assign('description', 'Video hot, video má»›i nhất, tin tức thể thao, Ä‘iện ảnh tại 123Vid'); $smarty->assign('keywords', 'Video hot video lastest,News,Sport,trailer'); $smarty->assign('image', $row_user['txt_avatar']); } } function goPcat(){ global $smarty,$func,$CORE,$memcache,$INFO,$print; $id_encode = $CORE->input['id']; $id = $func->str_encode(hex2bin($id_encode),'ngocgiac'); $url_get = 'https://m.youtube.com'.$id; $url_get = 'https://api1.vidoe.top/pcat.php?url='.base64_encode($url_get); $key_cache_trend = md5('video-pcat2-'.$url_get); $cache_trend = $memcache->get($key_cache_trend); if($cache_trend) { $content2 = $cache_trend; }else{ $content2 = $func->curl_func($url_get); if(!empty($content2)){ $memcache->set($key_cache_trend, $content2, MEMCACHE_COMPRESSED, 1200); } } $arr = json_decode($content2, true); if(!empty($arr['videos'])) { foreach ($arr['videos'] as $val) { if ($val['id'] != '') { $arr_item['title'] = $val['title']; $arr_item['title'] = trim(strip_tags(str_replace('"', '"', html_entity_decode($arr_item['title'])))); $arr_item['ftitle'] = $func->format_string($arr_item['title']); $arr_item['id'] = $val['id']; $arr_item['id_encode'] = bin2hex($func->str_encode($arr_item['id'], 'ngocgiac')); $arr_item['img'] = $val['img']; $arr_item['duration'] = $val['duration']; $arr_item['view'] = $val['view']; $arr_item['user_post'] = $val['channel_name']; $arr_item['fuser_post'] = $func->format_string($arr_item['user_post']); $arr_item['channel_url'] = basename($val['channel_url']); $arr_item['user_id'] = bin2hex($func->str_encode($val['channel_id'], 'ngocgiac')); $arr_item['label'] = $val['label']; $arr_check = explode($arr_item['user_post'], $arr_item['label']); if (strpos($arr_check[1], 'ago') !== false) { $arr_check = explode('ago', $arr_check[1]); $arr_item['ago'] = $arr_check[0] . ' ago'; } else { $arr_item['ago'] = str_replace(array($val['title']), array(''), $arr_item['label']); $arr_item['ago'] = str_replace(array($val['channel_name']), array(''), $arr_item['ago']); $arr_item['ago'] = str_replace(array('by'), array(''), $arr_item['ago']); $arr_check = explode('ago', $arr_item['ago']); $arr_item['ago'] = trim($arr_check[0]) . ' ago'; } $list[] = $arr_item; } } } $smarty->assign('detail',$arr); $smarty->assign('list_video',$list); if(!isset($_SESSION['county_fullname']) or empty($_SESSION['county_fullname'])) { $_SESSION['county_fullname'] = geoip_country_name_by_name($CORE->ip); } $county_fullname = $_SESSION['county_fullname']; $smarty->assign('county_fullname',$county_fullname); $smarty->assign('title2','Featured Videos '.$CORE->input['title']); if($_SESSION['lang']!='vi') { $smarty->assign('title', 'Popular videos today from '.$county_fullname.' trending '.$CORE->input['title']); $smarty->assign('description', 'Video hot, video lastest News, Sport, trailer,... at 123Vid'); $smarty->assign('keywords', 'Video hot,video lastest,News,Sport,trailer'); $smarty->assign('image', 'https://123vid.top/skin/phim98/assets/img/123vid.jpg'); }else{ $smarty->assign('title', 'Những video phổ biến hôm nay từ Việt Nam'); $smarty->assign('description', 'Video hot, video má»›i nhất, tin tức thể thao, Ä‘iện ảnh tại 123Vid'); $smarty->assign('keywords', 'Video hot video lastest,News,Sport,trailer'); $smarty->assign('image', 'https://123vid.top/skin/phim98/assets/img/123vid.jpg'); } } function goDaily(){ global $func,$smarty,$print; require ROOT_PATH.'lib/Dailymotion.php'; $apiKey = 'efe823f99c5a65e5ca88'; $apiSecret = '7cbaa1b7eab7846f5b52914546f00bb45cb89ebe'; $testUser = 'xxxgiacxxx@gmail.com'; $testPassword = 'Gunblade!23'; $scopes = array( 'userinfo', 'feed', 'manage_videos', ); $api = new Dailymotion(); $api->setGrantType( Dailymotion::GRANT_TYPE_PASSWORD, $apiKey, $apiSecret, $scopes, array( 'username' => $testUser, 'password' => $testPassword, ) ); /*$result = $api->get( '/videos?sort=trending&country=US&limit=40', array('fields' => array('id', 'title', 'thumbnail_large_url', 'duration')) );*/ $pageNum2 = ($_GET['pageNum2']>0) ? intval($_GET['pageNum2']) : 1; if($pageNum2<=100) { $result = $api->get( '/videos?sort=trending&country='.$_SESSION['country'].'&page=' . $pageNum2 . '&limit=40', array('fields' => array('id', 'title', 'thumbnail_large_url', 'duration')) ); print_r($result); exit(); $d_total = 800; $totalPage2 = ceil($d_total / 40); foreach ($result['list'] as $val) { $d_video['id'] = $val['id']; $d_video['title'] = $func->title_text($val['title']); $d_video['ftitle'] = $func->format_string($d_video['title']); $d_video['duration'] = gmdate('H:i:s', $val['duration']); $d_video['img'] = str_replace('http://','https://',$val['thumbnail_large_url']); $d_lists[] = $d_video; } $smarty->assign('d_videos', $d_lists); $nav4 = $print->Pagination2($totalPage2, $pageNum2, 'video-find-4', 'index.php?act=video'); $smarty->assign('nav4', $nav4); }else{ return; } } function goPlaylist(){ global $smarty,$func,$INFO,$CORE; include ROOT_PATH.'lib/simple_html_dom.php'; $country = $_SESSION['country']; $id_encode = $CORE->input['id']; $id = $func->str_encode($func->hex2bin($id_encode), 'ngocgiac'); //$day_time = date('d-m-Y'); $url = 'https://www.youtube.com/playlist?list='.$id; if(!file_exists('cache/youtube/playlist_detail_'.$country.'_'.$id)){ $content2 = $func->get_content_page($url,'https://google.com'); if(trim($content2)!='') { file_put_contents('cache/youtube/playlist_detail_'.$country.'_' . $id, $content2); } }else{ $content2 = file_get_contents('cache/youtube/playlist_detail_'.$country.'_'.$id); } $html = str_get_html($content2); $list2 = array(); foreach($html->find('tr.pl-video') as $val){ $url_yt = 'https://www.youtube.com'.$val->find('.pl-video-thumb a',0)->href; $arr_content['main_title'] = trim($html->find('title',0)->plaintext); $arr_content['title'] = trim($val->find('.pl-video-title a',0)->plaintext); $arr_content['ftitle'] = $func->format_string($arr_content['title']); $arr_content['url'] = $url_yt; $arr_content['id'] = $func->get_id_youtube($url_yt); $arr_content['id_encode'] = bin2hex($func->str_encode($arr_content['id'], 'ngocgiac')); $arr_content['img'] = '//i.ytimg.com/vi/' .$arr_content['id'] . '/mqdefault.jpg'; $arr_content['view'] = $val->find('.timestamp span',0)->plaintext; $list2[] = $arr_content; } //$arr_content = json_decode($content2,true); $main_title = trim(str_replace('- YouTube','',$list2[0]['main_title'])); $smarty->assign('videos',$list2); $smarty->assign('main_title',$main_title); $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 goTopic(){ global $CORE,$smarty,$func; include ROOT_PATH.'lib/simple_html_dom.php'; $country = $_SESSION['country']; $id_encode = $CORE->input['id']; $id = $func->str_encode($func->hex2bin($id_encode), 'ngocgiac'); $url_get = 'https://www.youtube.com/channel/'.$id; $day_file_name = $country.'-topic-'.$id; $content2 = ''; if(!file_exists('cache/youtube/'.$day_file_name)){ $content2 = $func->get_content_page($url_get,''); if(trim($content2)!='') { file_put_contents('cache/youtube/' . $day_file_name, $content2); } }else{ $content2 = file_get_contents('cache/youtube/'.$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(array('- YouTube','YouTube'),array('',''),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 goChannel2(){ global $CORE,$func,$smarty,$INFO,$print; $id_encode = $CORE->input['id']; $id = $func->str_encode($func->hex2bin($id_encode), 'ngocgiac'); $val_off = $INFO['api_key']; require ROOT_PATH . 'proxy/Google/Client.php'; require ROOT_PATH . 'proxy/Google/Service/YouTube.php'; $client = new Google_Client(); $client->setDeveloperKey($val_off); $youtube = new Google_Service_YouTube($client); //get info channel $channel_info = $youtube->channels->listChannels( 'snippet,contentDetails,statistics', array('id' => $id) ); foreach ($channel_info['items'] as $channel) { echo $channel['snippet']['title']; } exit(); } function goChannel3(){ global $CORE,$func; $token = $CORE->input['token']; $ref = base64_decode($CORE->input['ref']); $url = 'https://img.123vid.top/yt_cn_con.php?token='.$token.'&ref='.$ref; $data = $func->curl_func($url); $detail = json_decode($data,true); $i = 0; foreach ($detail['videos'] as $video) { $detail['videos'][$i]['title'] = trim(strip_tags(str_replace('"', '"', html_entity_decode($video['title'])))); $detail['videos'][$i]['ftitle'] = $func->format_string($video['title']); $detail['videos'][$i]['id_you'] = $video['id']; $detail['videos'][$i]['img'] = $video['img']; $detail['videos'][$i]['id_you_encode'] = bin2hex($func->str_encode($video['id'], 'ngocgiac')); $detail['videos'][$i]['duration'] = $video['duration']; $i++; } echo json_encode($detail); exit(); } function goChannel(){ global $CORE,$func,$smarty,$INFO,$print; $id_encode = $CORE->input['id']; $arr_delete = array('x1wuo7l','ee8df86527cd84ff2f320e50d4c47636da95361394858df2'); if(in_array($id_encode,$arr_delete)){ $print->refresh($INFO['home_url'].'404/index.html'); } $c_type = ''; if(strlen($id_encode)>8) { //youtube channel $pageNum3 = 1; if (isset($CORE->input['pageNum2'])) { $pageNum3 = $CORE->input['pageNum2']; $smarty->assign('pageNum3', $pageNum3); } $id = $func->str_encode($func->hex2bin($id_encode), 'ngocgiac'); if(strpos($id,'https://xvideos')===false) { $content2 = $func->curl_func('https://api1.vidoe.top/yt_cn2.php?id=' . $id); $c_type = 'youtube'; }else{ if (isset($_COOKIE['over18']) && $_COOKIE['over18'] == $CORE->ip) { $page = $pageNum3 - 1; $content2 = $func->curl_func('https://img.vidoe.top/cn18.php?id=' . base64_encode($id) . '&page=' . $page); //echo 'https://img.123vid.top/cn18.php?id=' . base64_encode($id) . '&page=' . $page; $c_type = 'xvideos'; }else{ $_SESSION['detail_url_check'] = $func->current_url(); $print->refresh($INFO['home_url'].'18plus/'); } } $data = json_decode($content2,true); $detail['title'] = $data['title']; $detail['ftitle'] = $func->format_string($detail['title']); $detail['description'] = $data['des']; $detail['des'] = preg_replace('@(https?://([-\w\.]+[-\w])+(:\d+)?(/([\w/_\.#-]*(\?\S+)?[^\.\s])?)?)@', '<a href="$1" target="_blank" rel="nofollow">$1</a>', $detail['description']); $detail['des'] = preg_replace("/\r|\n/", "<br/>", $detail['des']); $detail['subs'] = $data['subs']; $detail['username'] = ''; $detail['publishedAt'] = date('M d Y'); $detail['avatar'] = $data['avatar']; $detail['banner'] = $data['banner']; $detail['videoCount'] = count($data['videos'])+rand(50,1000); $list2 = array(); foreach ($data['videos'] as $video) { $relate['ftitle'] = $func->format_string($video['title']); $relate['title'] = trim(strip_tags(str_replace('"', '"', html_entity_decode($video['title'])))); $relate['id_you'] = $video['id']; if($c_type != 'xvideos') { $relate['img'] = 'https://img.youtube.com/vi/' . $relate['id_you'] . '/mqdefault.jpg'; $relate['id_you_encode'] = bin2hex($func->str_encode($relate['id_you'], 'ngocgiac')); }else{ $relate['img'] = $video['img']; $relate['id_you_encode'] = $video['id']; } $relate['duration'] = $video['duration']; $list2[] = $relate; } if($c_type != 'xvideos') { $nav3 = '<li class="page-item active" id="show_more_channel"><a class="page-link" href="javascript:void(0);" onclick="show_more_channel(\'' . $data['continuation'] . '\',\'' . $data['ref'] . '\');">Show more</a></li>'; }else{ $data['des2'] = trim(str_replace(array($data['videos'][0]['user_name'],'videos','\n','uploaded'),array('','','',''),$data['des'])); //$totalPage2 = intval($data['des2']); $totalPage2 = $data['total_page']; if(intval($totalPage2)==0){ $totalPage2 = intval($data['des2']); } //echo $data['des2'].','.$totalPage2.','.$data['videos'][0]['user_name']; $nav3 = $print->Pagination2($totalPage2, $pageNum3, 'video-find-4', '?act=video&code=channel&id=' . $id_encode . '&ftitle=' . $detail['ftitle']); } $smarty->assign('list2s', $list2); $smarty->assign('nav3', $nav3); }else{ $c_type = 'dailymotion'; $pageNum3 = 1; if (isset($CORE->input['pageNum2'])) { $pageNum3 = $CORE->input['pageNum2']; $smarty->assign('pageNum3', $pageNum3); } /*require ROOT_PATH.'lib/Dailymotion.php'; $apiKey = 'efe823f99c5a65e5ca88'; $apiSecret = '7cbaa1b7eab7846f5b52914546f00bb45cb89ebe'; $testUser = 'xxxgiacxxx@gmail.com'; $testPassword = 'Gunblade!23'; $scopes = array( 'userinfo', 'feed', 'manage_videos', ); $api = new Dailymotion(); $api->setGrantType( Dailymotion::GRANT_TYPE_PASSWORD, $apiKey, $apiSecret, $scopes, array( 'username' => $testUser, 'password' => $testPassword, ) ); $user = $api->get( '/user/'.$id_encode, array('fields' => array('avatar_120_url','cover_200_url', 'username','description','created_time','videos_total')) );*/ $content3 = $func->curl_func('https://st2.123vid.net/user_channel.php?id='.$id_encode); $user = json_decode($content3,true); $detail['id_encode'] = $id_encode; $detail['title'] = $user['username']; $detail['ftitle'] = $func->format_string($detail['title']); $detail['description'] = $user['description']; $detail['des'] = preg_replace('@(https?://([-\w\.]+[-\w])+(:\d+)?(/([\w/_\.#-]*(\?\S+)?[^\.\s])?)?)@', '<a href="$1" target="_blank" rel="nofollow">$1</a>', html_entity_decode($user['description'])); $detail['des'] = preg_replace("/\r|\n/", "<br/>", $detail['des']); $detail['username'] = 'channel/'.$id_encode.'/'.$user['username']; $detail['publishedAt'] = date('M d Y', $user['created_time']); $detail['avatar'] = str_replace('http://','https://',$user['avatar_120_url']); if(!empty($user['cover_200_url'])) { $detail['banner'] = 'https://img.vidoe.top/image.php?file=' . base64_encode($user['cover_200_url']) . '&w=1349&h=222'; }else{ $detail['banner'] = 'https://i.imgur.com/Pzq8O5N.png'; } $detail['videoCount'] = $user['videos_total']; $detail['subs'] = $user['videos_total'].' videos'; //get list video from user /*$result = $api->get( '/user/'.$id_encode.'/videos?fields=duration,id,thumbnail_720_url,title,&page='.$pageNum3.'&limit=50', array('fields' => array('id', 'title', 'thumbnail_720_url', 'duration')) );*/ $content2 = $func->curl_func('https://st2.123vid.net/daily_channel.php?id='.$id_encode.'&pageNum2='.$pageNum3); $result = json_decode($content2,true); $totalPage2 = ceil($detail['videoCount'] / 50); foreach ($result['list'] as $val) { $d_video['id_you'] = ''; $d_video['id_you_encode'] = $val['id']; $d_video['title'] = $func->title_text($val['title']); $d_video['ftitle'] = $func->format_string($d_video['title']); $d_video['duration'] = gmdate('H:i:s', $val['duration']); if(substr($d_video['duration'],0,3)=='00:'){ $d_video['duration'] = substr($d_video['duration'],-5); } $d_video['img'] = str_replace('http://','https://',$val['thumbnail_720_url']); $d_video['img'] = 'https://img.vidoe.top/image.php?file='.base64_encode($d_video['img']).'&w=686&h=386'; $d_lists[] = $d_video; } $smarty->assign('list2s', $d_lists); $nav4 = $print->Pagination2($totalPage2, $pageNum3, 'video-find-4', '?act=video&code=channel&id=' . $id_encode . '&ftitle=' . $detail['ftitle']); $smarty->assign('nav3', $nav4); } $smarty->assign('detail', $detail); $smarty->assign('cur_url', $func->current_url()); $smarty->assign('title',$detail['title']); $seo_des = $func->title_text(strip_tags($detail['description'])); if(empty($seo_des)){ $seo_des = $func->title_text($detail['title']).' '.$detail['publishedAt']; } $smarty->assign('description',$seo_des); $smarty->assign('image',$detail['avatar']); $smarty->assign('keywords',$detail['title']); $smarty->assign('c_type',$c_type); } function goDownload2(){ global $CORE,$func,$print; $my_id = $CORE->input['id']; $id_you_encode = bin2hex($func->str_encode($my_id, 'ngocgiac')); $print->refresh('https://123vid.top/video/download/movieandvideo.net-'.$id_you_encode.'.html'); exit(); } function goDownload(){ global $CORE,$smarty,$func; $my_id = $CORE->input['id']; if(strlen($my_id)>8) { //youtube video $my_id = $func->str_encode($func->hex2bin($my_id), 'ngocgiac'); $detail['id_encode'] = $CORE->input['id']; //$my_id = $func->str_encode($func->hex2bin($my_id), 'ngocgiac'); //$my_video_info = 'https://www.youtube.com/get_video_info?video_id=' . $my_id . '&asv=3&el=detailpage&hl=en_US'; //$my_video_info = $func->get_content_page($my_video_info, ''); $title = $url_encoded_fmt_stream_map = $type = $url = ''; //parse_str($my_video_info); $noembed = json_decode($func->get_content_page('https://www.youtube.com/oembed?url=http://www.youtube.com/watch?v=' . $my_id . '&format=json', 'https://youtube.com')); $title = $noembed->title; $detail['title'] = $title; $detail['ftitle'] = $func->format_string($title); $txt_play = 'https://www.youtube.com/watch?v=' . $my_id; $detail['img'] = 'https://img.youtube.com/vi/' . $my_id . '/mqdefault.jpg'; $link_encode = bin2hex($func->str_encode($txt_play, 'ngocgiac')); $detail['txt_download'] = $func->encode_html('<iframe id="player_iframe" src="proxy/download2.php?url=' . $link_encode . '" frameborder="0" style="overflow:hidden;height:100%;width:100%;min-height: 500px;" height="100%" width="100%"></iframe>'); }else{//daily motion $id = $my_id; $url_daily = 'http://www.dailymotion.com/embed/video/'.$my_id; require ROOT_PATH.'lib/Dailymotion.php'; $apiKey = '31c2d7ae78aca3f0b14c'; $apiSecret = '13ef6e5c0860da5e5f4b4f2db0b1ce8313d5da9c'; $testUser = 'xxxgiacxxx@gmail.com'; $testPassword = 'Gunblade!23'; $scopes = array( 'userinfo', 'feed', 'manage_videos', ); $api = new Dailymotion(); $api->setGrantType( Dailymotion::GRANT_TYPE_PASSWORD, $apiKey, $apiSecret, $scopes, array( 'username' => $testUser, 'password' => $testPassword, ) ); $arr_content = $api->get( '/video/'.$id, array('fields' => array('id', 'title', 'thumbnail_large_url','duration','description','owner.username','owner.id','owner.avatar_240_url','tags','thumbnail_120_url','thumbnail_360_url','thumbnail_720_url')) ); $detail['title'] = $title = $arr_content['title']; $detail['ftitle'] = $func->format_string($detail['title']); $detail['img'] = $arr_content['thumbnail_360_url']; $link_encode = bin2hex($func->str_encode($url_daily, 'ngocgiac')); $detail['txt_download'] = $func->encode_html('<iframe id="player_iframe" src="proxy/download_daily.php?url=' . $link_encode . '" frameborder="0" style="overflow:hidden;height:100%;width:100%" height="100%" width="100%"></iframe>'); $detail['id_encode'] = $id; } $smarty->assign('detail',$detail); $smarty->assign('title', trim(strip_tags(str_replace('"', '"', html_entity_decode('Download the video "'.$title.'"'))))); $smarty->assign('description', trim(strip_tags(str_replace('"', '"', html_entity_decode('Download the video "'.$title.'"'))))); $smarty->assign('image', $detail['img']); $smarty->assign('cur_url','https://123vid.top/video/'.$detail['ftitle'].'-'.$detail['id_encode'].'.html'); $smarty->assign('keywords',$title); } function getIdVideo($url) { // get video ID from $_GET $v=''; if (!isset($url)) { return 'Please enter a YouTube video URL.'; } else { $vid = stripslashes($url); $string = $vid; $url = parse_url($string); parse_str($url['query']); } return $v; } function goIndex2(){ global $smarty,$func,$CORE,$memcache,$INFO,$DB; $q_lastest_video = $DB->query("SELECT a.*,b.name,b.fullname FROM gtdesign_video a LEFT JOIN gtdesign_user b ON a.uid=b.id WHERE a.status='1' ORDER BY a.time DESC LIMIT 10"); while ($r_lastest_video = $DB->fetch_row($q_lastest_video)) { $r_lastest_video['title'] = $func->title_text($r_lastest_video['title']); $r_lastest_video['ftitle'] = $func->format_string($r_lastest_video['title']); if (strpos($r_lastest_video['img'], 'dmcdn.net') !== false) { $r_lastest_video['img'] = 'https://img.123vid.top/image.php?file=' . base64_encode($r_lastest_video['img']) . '&w=686&h=386'; } if (!empty($r_lastest_video['name'])) { $r_lastest_video['channel_url'] = 'user/' . $r_lastest_video['name'] . '/'; } else { $r_lastest_video['channel_url'] = 'video/post/' . $r_lastest_video['uid'] . '/'; } $r_lastest_video['ago'] = $func->timeago($r_lastest_video['time']); $list_lastest_video[] = $r_lastest_video; } $smarty->assign('list_lastest_video',$list_lastest_video); //show channel $key_video_local = md5("SELECT uid, count(id) AS so_upload FROM gtdesign_video GROUP BY uid ORDER BY so_upload DESC LIMIT 35 "); $cache_video_local = $memcache->get($key_video_local); if($cache_video_local){ $list_uid = $cache_video_local; }else { $q_video_local = $DB->query("SELECT uid, count(id) AS so_upload FROM gtdesign_video GROUP BY uid ORDER BY so_upload DESC LIMIT 35 "); while ($r_video_local = $DB->fetch_row($q_video_local)) { $list_uid[$r_video_local['uid']] = $r_video_local['so_upload']; } $memcache->set($key_video_local, $list_uid, MEMCACHE_COMPRESSED, 1200); } foreach ($list_uid as $key=>$val) { $arr_uid[] = $key; } $txt_uid = implode(',', $arr_uid); $key_user_local = md5("SELECT id,name,fullname,avatar FROM gtdesign_user WHERE id IN (".$txt_uid.") ORDER BY id DESC"); $cache_user_local = $memcache->get($key_user_local); if($cache_user_local){ $list_users_video = $cache_user_local; }else { $q_user_local = $DB->query("SELECT id,name,fullname,avatar FROM gtdesign_user WHERE id IN (" . $txt_uid . ") ORDER BY id DESC"); while ($r_user_local = $DB->fetch_row($q_user_local)) { if (!empty($r_user_local['name'])) { $list_user_local['url'] = 'user/' . $r_user_local['name'] . '/'; } else { $list_user_local['url'] = 'video/post/' . $r_user_local['id'] . '/'; } $list_user_local['avatar'] = $r_user_local['avatar']; $list_user_local['fullname'] = $r_user_local['fullname']; $list_user_local['so_video'] = $list_uid[$r_user_local['id']]; $list_users_video[] = $list_user_local; } $memcache->set($key_user_local, $list_users_video, MEMCACHE_COMPRESSED, 1200); } $smarty->assign('list_users_video',$list_users_video); $url_get = 'https://m.youtube.com/feed/trending/?gl='.$_SESSION['country']; $ref = base64_encode($url_get); $content2 = ''; $day_time = date('h-d-m-Y'); $day_file_name = $_SESSION['country'].'-'.$day_time; if(!file_exists('cache/youtube/trending-'.$day_file_name)){ $content2 = $this->curl_func_home($url_get); if(trim($content2)!='') { file_put_contents('cache/youtube/trending-'.$day_file_name, $content2); } }else{ $content2 = file_get_contents('cache/youtube/trending-'.$day_file_name); } $arr_content = explode('var ytInitialData = \'',$content2); $arr2 = explode('\';</script>',$arr_content[1]); $str= $this->weird_answer_to_weird_question($arr2[0]); $str = html_entity_decode(stripslashes(str_ireplace('\\"','',$str))); $data = $this->custom_json_decode($str,true); $arr['title'] = $_SESSION['country'].' Trending'; $arr['token'] = $data['value']['contents']['singleColumnBrowseResultsRenderer']['tabs']['0']['tabRenderer']['content']['sectionListRenderer']['contents']['15']['continuationItemRenderer']['continuationEndpoint']['continuationCommand']['token']; $arr['ref'] = $ref; $arr['country'] = $_SESSION['country']; $arr['videos'] = array(); $i=0; foreach($data['value']['contents']['singleColumnBrowseResultsRenderer']['tabs']['0']['tabRenderer']['content']['sectionListRenderer']['contents'] as $key=>$val){ if(!empty($val['itemSectionRenderer']['contents']['0']['videoWithContextRenderer']['navigationEndpoint']['watchEndpoint']['videoId']) or !empty($val['itemSectionRenderer']['contents']['0']['videoWithContextRenderer']['navigationEndpoint']['reelWatchEndpoint']['videoId'])) { $arr['videos'][$i]['title'] = $val['itemSectionRenderer']['contents']['0']['videoWithContextRenderer']['headline']['runs']['0']['text']; $arr['videos'][$i]['title'] = trim(strip_tags(str_replace('"', '"', html_entity_decode($arr['videos'][$i]['title'])))); $arr['videos'][$i]['id'] = $val['itemSectionRenderer']['contents']['0']['videoWithContextRenderer']['navigationEndpoint']['watchEndpoint']['videoId'] ?? $val['itemSectionRenderer']['contents']['0']['videoWithContextRenderer']['navigationEndpoint']['reelWatchEndpoint']['videoId']; $arr['videos'][$i]['ftitle'] = $func->format_string($arr['videos'][$i]['title']); $arr['videos'][$i]['id_encode'] = bin2hex($func->str_encode($arr['videos'][$i]['id'], 'ngocgiac')); if (isset($val['itemSectionRenderer']['contents']['0']['videoWithContextRenderer']['thumbnail']['thumbnails']['4']['url']) && $val['itemSectionRenderer']['contents']['0']['videoWithContextRenderer']['thumbnail']['thumbnails']['4']['url'] != '') { $arr['videos'][$i]['img'] = $val['itemSectionRenderer']['contents']['0']['videoWithContextRenderer']['thumbnail']['thumbnails']['4']['url']; } else { $arr['videos'][$i]['img'] = 'https://img.youtube.com/vi/' . $arr['videos'][$i]['id'] . '/mqdefault.jpg'; } $arr['videos'][$i]['duration'] = $val['itemSectionRenderer']['contents']['0']['videoWithContextRenderer']['lengthText']['runs']['0']['text']; $arr['videos'][$i]['label'] = $val['itemSectionRenderer']['contents']['0']['videoWithContextRenderer']['headline']['accessibility']['accessibilityData']['label']; $arr['videos'][$i]['view'] = $val['itemSectionRenderer']['contents']['0']['videoWithContextRenderer']['shortViewCountText']['runs']['0']['text']; $arr['videos'][$i]['channel_name'] = $val['itemSectionRenderer']['contents']['0']['videoWithContextRenderer']['shortBylineText']['runs']['0']['text']; $arr['videos'][$i]['channel_url'] = $val['itemSectionRenderer']['contents']['0']['videoWithContextRenderer']['shortBylineText']['runs']['0']['navigationEndpoint']['commandMetadata']['webCommandMetadata']['url']; $arr['videos'][$i]['channel_id'] = $val['itemSectionRenderer']['contents']['0']['videoWithContextRenderer']['shortBylineText']['runs']['0']['navigationEndpoint']['browseEndpoint']['browseId']; $arr['videos'][$i]['user_post'] = $arr['videos'][$i]['channel_name']; $arr['videos'][$i]['fuser_post'] = $func->format_string($arr['videos'][$i]['user_post']); $arr['videos'][$i]['channel_url'] = basename($arr['videos'][$i]['channel_url']); $arr['videos'][$i]['user_id'] = bin2hex($func->str_encode($arr['videos'][$i]['channel_id'], 'ngocgiac')); $arr['videos'][$i]['label'] = $arr['videos'][$i]['label']; $arr_check = explode($arr['videos'][$i]['user_post'], $arr['videos'][$i]['label']); if (strpos($arr_check[1], 'ago') !== false) { $arr_check = explode('ago', $arr_check[1]); $arr['videos'][$i]['ago'] = $arr_check[0] . ' ago'; } else { $arr['videos'][$i]['ago'] = str_replace(array($arr['videos'][$i]['title']), array(''), $arr['videos'][$i]['label']); $arr['videos'][$i]['ago'] = str_replace(array($arr['videos'][$i]['channel_name']), array(''), $arr['videos'][$i]['ago']); $arr['videos'][$i]['ago'] = str_replace(array('by'), array(''), $arr['videos'][$i]['ago']); $arr_check = explode('ago', $arr['videos'][$i]['ago']); $arr['videos'][$i]['ago'] = trim($arr_check[0]) . ' ago'; } } $i++; } $arr['submenu'] = array(); $j=0; foreach($data['contents']['singleColumnBrowseResultsRenderer']['tabs']['0']['tabRenderer']['content']['sectionListRenderer']['subMenu']['channelListSubMenuRenderer']['contents'] as $key=>$val){ $arr['submenu'][$j]['img'] = $val['channelListSubMenuAvatarRenderer']['thumbnail']['thumbnails']['2']['url']; $arr['submenu'][$j]['title'] = $val['channelListSubMenuAvatarRenderer']['title']['runs']['0']['text']; $arr['submenu'][$j]['ftitle'] = $func->format_string($arr['submenu'][$j]['title']); $arr['submenu'][$j]['ftitle'] = str_replace(array('gaming','news','movies'),array('gamepad','newspaper-o','file-video-o'),$arr['submenu'][$j]['ftitle']); $arr['submenu'][$j]['url'] = $val['channelListSubMenuAvatarRenderer']['navigationEndpoint']['commandMetadata']['webCommandMetadata']['url']; $arr['submenu'][$j]['id_encode'] = bin2hex($func->str_encode($arr['submenu'][$j]['url'], 'ngocgiac')); $j++; } $smarty->assign('detail',$arr); if(!isset($_SESSION['county_fullname']) or empty($_SESSION['county_fullname'])) { $_SESSION['county_fullname'] = geoip_country_name_by_name($CORE->ip); } $county_fullname = $_SESSION['county_fullname']; $smarty->assign('county_fullname',$county_fullname); $arr_other = array( '0'=>array('title'=>'Music','id'=>bin2hex($func->str_encode('UC-9-kyTW8ZkZNDHQJ6FgpwQ', 'ngocgiac')),'img'=>'https://yt3.ggpht.com/qmXE5hiMlLM9lZYR9Sf0Cv318r9HjBkl1oCy5e5CuGX9tCnJT5cYlISpiLRhBuRBDn5zNTuftw=s100-c-k-c0xffffffff-no-rj-mo'), '1'=>array('title'=>'Sports','id'=>bin2hex($func->str_encode('UCEgdi0XIXXZ-qJOFPf4JSKw', 'ngocgiac')),'img'=>'https://yt3.ggpht.com/VjFr87y37hibag7chs_MC-TH7byxLUpA-RClLiRUxX2jlB9KBAJQbBpSXjdVPB8W3DTOOVjvg9M=s100-c-k-c0xffffffff-no-rj-mo'), '2'=>array('title'=>'News','id'=>bin2hex($func->str_encode('UCYfdidRxbB8Qhf0Nx7ioOYw', 'ngocgiac')),'img'=>'https://yt3.ggpht.com/dTAqfxkze5GTKk8lB87XFli6GBppuoOiCZ49MaucV76-TSFE8m2I4bY8IbHshkdR1ioRdJ4S=s100-c-k-c0xffffffff-no-rj-mo'), '3'=>array('title'=>'Live','id'=>bin2hex($func->str_encode('UC4R8DWoMoI7CAwX8_LjQHig', 'ngocgiac')),'img'=>'https://yt3.ggpht.com/5HkUAx2SOolanKFGX7Au5O84m4XbzvjpxXowcw2EYjbZmUObb_MzjZiiSDfy3z9ImpC0PCuZIB_dlPnEqQ=s100-c-k-c0xffffffff-no-rj-mo'), ); $smarty->assign('list_main_cn2',$arr_other); if($_SESSION['lang']!='vi') { $smarty->assign('title', 'Popular videos today from '.$county_fullname); $smarty->assign('description', 'Video hot, video lastest News, Sport, trailer,... at 123Vid'); $smarty->assign('keywords', 'Video hot,video lastest,News,Sport,trailer'); $smarty->assign('image', 'https://123vid.top/skin/phim98/assets/img/123vid.jpg'); }else{ $smarty->assign('title', 'Những video phổ biến hôm nay từ Việt Nam'); $smarty->assign('description', 'Video hot, video má»›i nhất, tin tức thể thao, Ä‘iện ảnh tại 123Vid'); $smarty->assign('keywords', 'Video hot video lastest,News,Sport,trailer'); $smarty->assign('image',$INFO['home_url'].'skin/'.$INFO['skin_folder'].'/img/vidoe-logo.png'); } } function goIndex(){ global $smarty,$func,$CORE,$INFO; if(!isset($_SESSION['county_fullname']) or empty($_SESSION['county_fullname'])) { $_SESSION['county_fullname'] = geoip_country_name_by_name($CORE->ip); } //hom nay xem gi include ROOT_PATH.'lib/simple_html_dom.php'; $day_time = date('d-m-Y'); $day_file_name = $_SESSION['country'].'-'.$day_time; $county_fullname = $_SESSION['county_fullname']; $url_get = 'https://www.youtube.com/feed/trending?gl='.$_SESSION['country']; $smarty->assign('county_fullname',$county_fullname); //new //$url_get = 'https://www.googleapis.com/youtube/v3/videos?part=contentDetails&chart=mostPopular®ionCode='.$_SESSION['country'].'&maxResults=30&key='.$INFO['api_key']; if(!file_exists('cache/youtube/'.$day_file_name)){ $content2 = $func->get_content_page($url_get,'https://www.youtube.com'); if(trim($content2)!='') { file_put_contents('cache/youtube/' . $day_file_name, $content2); } }else{ $content2 = file_get_contents('cache/youtube/'.$day_file_name); } //$arr_css_list = array('panel-block video-list grid'); $html = str_get_html($content2); $i = 1; if (!empty($html)) { foreach ($html->find('li.expanded-shelf-content-item-wrapper') as $val) { if ($i <= 30) { $re['title'] = $val->find('h3.yt-lockup-title a', 0)->plaintext; $re['ftitle'] = $func->format_string($re['title']); $re['id_you'] = $this->getIdVideo($val->find('h3.yt-lockup-title a', 0)->href); $re['id_you_encode'] = bin2hex($func->str_encode($re['id_you'], 'ngocgiac')); $re['img'] = 'https://i.ytimg.com/vi/' . $re['id_you'] . '/mqdefault.jpg'; $re['duration'] = $val->find('span.video-time', 0)->plaintext; //$re['hit'] = str_replace(' views', '', $val->find('ul.yt-lockup-meta-info li', 0)->plaintext); $list_re[] = $re; } $i++; } } $smarty->assign('css_active','panel-block video-list grid'); $smarty->assign('list_res',$list_re); if($_SESSION['lang']!='vi') { $smarty->assign('title', 'Popular videos today from '.$county_fullname); $smarty->assign('description', 'Video hot, video lastest News, Sport, trailer,... at 123Vid'); $smarty->assign('keywords', 'Video hot,video lastest,News,Sport,trailer'); $smarty->assign('image', 'https://123vid.top/skin/phim98/assets/img/123vid.jpg'); }else{ $smarty->assign('title', 'Những video phổ biến hôm nay từ Việt Nam'); $smarty->assign('description', 'Video hot, video má»›i nhất, tin tức thể thao, Ä‘iện ảnh tại 123Vid'); $smarty->assign('keywords', 'Video hot video lastest,News,Sport,trailer'); $smarty->assign('image',$INFO['home_url'].'skin/'.$INFO['skin_folder'].'/img/vidoe-logo.png'); } } function goList(){ global $smarty,$CORE,$DB,$func,$print,$INFO,$lang; /*$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];*/ $val_off = $INFO['api_key']; require_once ROOT_PATH.'proxy/Google/Client.php'; require_once ROOT_PATH.'proxy/Google/Service/YouTube.php'; $client = new Google_Client(); $client->setDeveloperKey($val_off); $youtube = new Google_Service_YouTube($client); $legion = 'VN'; if(isset($_SESSION['countryName']) and $_SESSION['countryName']!=''){ $legion = $_SESSION['countryName']; } if($_SESSION['lang']!='vi') { $hl = 'en_US'; }else{ $hl = 'vi_VN'; } $url = 'https://www.googleapis.com/youtube/v3/videoCategories?part=snippet&hl='.$hl.'®ionCode='.$legion.'&key='.$INFO['api_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']; $list['cat_ftitle'] = $func->format_string($list['cat_title']); $list2[] = $list; } $arr_cat_you = $list2; $ftitle = trim($CORE->input['cat']); $d_ftitle = ''; switch($ftitle){ case 'gaming': $cat_you = 20; $d_ftitle='videogames'; break; case 'comedy': $cat_you = 23; $d_ftitle='fun'; break; case 'news': $cat_you = 25; $d_ftitle='news'; break; case 'moto-oto': $cat_you = 2; $d_ftitle='auto'; break; case 'sport': $cat_you = 17; $d_ftitle='sport'; break; case 'trailer': $cat_you = 1; $d_ftitle='shortfilms'; break; case 'entertainment': $cat_you = 24; $d_ftitle='creation'; break; case 'music': $cat_you = 10; $d_ftitle='music'; break; case 'travel-events': $cat_you = 19; $d_ftitle='travel'; break; case 'hi-tech': $cat_you = 40; $d_ftitle='tech'; break; case 'science': $cat_you = 28; $d_ftitle='tech'; break; case 'pets-animals' : $cat_you = 15; $d_ftitle='animals'; break; case 'short-movies' : $cat_you = 18; $d_ftitle='shortfilms'; break; case 'education' : $cat_you = 27; $d_ftitle='school'; break; case 'anime' : $cat_you = 31; $d_ftitle='animes'; break; //more cat default: foreach($arr_cat_you as $val){ if($val['cat_ftitle']==$ftitle){ $cat_you = $val['cat_id_you']; } } break; } if(isset($CORE->input['categoryid']) and $CORE->input['categoryid']>0) { $cat_you = intval($CORE->input['categoryid']); } $smarty->assign('cat_you',$cat_you); $title = ''; foreach($arr_cat_you as $val){ if($val['cat_id_you']==$cat_you){ if($_SESSION['lang']!='vi') { $title = 'All videos of category ' . $val['cat_title']; }else{ $title = 'Các video thể loại ' . $val['cat_title']; } } $list_cat['cat_id_you'] = $val['cat_id_you']; $list_cat['title_cat_you'] = $val['cat_title']; $list_cat['ftitle_cat_you'] = $val['cat_ftitle']; $list_cats[] = $list_cat; } $smarty->assign('list_cat_you',$list_cats); $where = ' 1 AND status=1 '; if(isset($CORE->input['cat']) and $CORE->input['cat']!=''){ $where .= " AND theloai LIKE '%".$CORE->input['cat']."%' "; $smarty->assign('cat',$CORE->input['cat']); } if(isset($CORE->input['user']) and $CORE->input['user']!=''){ $row_user = $DB->fetch_row($DB->query("SELECT fullname FROM gtdesign_user WHERE id='".$CORE->input['user']."' ")); $where .= " AND uid = '".$CORE->input['user']."' "; if($_SESSION['lang']=='en') { $title = 'All videos posted by ' . $row_user['fullname']; }else{ $title = 'Các videos đăng bởi ' . $row_user['fullname']; } $smarty->assign('uid',$CORE->input['user']); $txt_username = $row_user['fullname']; $smarty->assign('txt_username',$txt_username); } $smarty->assign('cat',$CORE->input['cat']); $pageNum = isset($_GET['pageNum']) ? intval($_GET['pageNum']) : 1; $smarty->assign('pagenum',$pageNum); $pageSize = 30 ; $from = (($pageNum * $pageSize) - $pageSize); $row_total_news = $DB->fetch_row($DB->query("SELECT count(*) as total FROM gtdesign_video WHERE ".$where." ")); $total = $row_total_news['total']; $totalPage = ceil($total/$pageSize); $smarty->assign('totalpage',$totalPage); if(isset($CORE->input['user']) and $CORE->input['user']!='') { $q2 = $DB->query(" SELECT * FROM gtdesign_video WHERE " . $where . " ORDER BY `time` DESC LIMIT $from , $pageSize "); while($r_video = $DB->fetch_row($q2)){ $r_video['title'] = trim(strip_tags(str_replace('"','"',html_entity_decode($r_video['title'])))); $r_video['encode_img'] = bin2hex($func->str_encode($r_video['img'], 'ngocgiac')); $r_video['ftitle'] = $func->format_string($r_video['title']); $row_user2 = $DB->fetch_row($DB->query("SELECT fullname FROM gtdesign_user WHERE id='".$r_video['uid']."' ")); $r_video['user_name'] = $row_user2['fullname']; $r_video['txt_time'] = date('M d Y',$r_video['time']); $list_pl[] = $r_video; } $smarty->assign('videos',$list_pl); $smarty->assign('is_user',1); $nav = $print->Pagination($totalPage,$pageNum,'pages','index.php?act=video&code=list&cat='.$CORE->input['cat'].'&user='.$CORE->input['user']); $smarty->assign('nav',$nav); }else{ //$q2 = $DB->query(" SELECT * FROM gtdesign_video WHERE " . $where . " ORDER BY `time` DESC LIMIT 0 , 10 "); $smarty->assign('is_user',0); $smarty->assign('videos',array()); $smarty->assign('nav',''); } if($pageNum>1){ $title .= $title. ' | '.$lang['trang'].' '.$pageNum; } if (isset($CORE->input['pageNum3'])) { $pageNum3 = $CORE->input['pageNum3']; $smarty->assign('pageNum3', $pageNum3); } //get video annoder api $max_result = 30; $arr_xml = array(); $list = array(); $searchResponse = $youtube->search->listSearch('snippet', array( 'type' => 'video', 'videoCategoryId' => $cat_you, 'regionCode' => $legion, 'maxResults' => $max_result, 'videoEmbeddable' => 'true', 'pageToken' => $pageNum3 )); foreach ($searchResponse['items'] as $searchResult) { $list['title'] = $searchResult['snippet']['title']; $list['id_you'] = $searchResult['id']['videoId']; $arr_xml['video_info'][] = $list; } $arr_xml['nextPageToken'] = $searchResponse['nextPageToken']; $arr_xml['prevPageToken'] = $searchResponse['prevPageToken']; $list2 = array(); if (!empty($arr_xml)) { foreach ($arr_xml['video_info'] as $video) { $relate['ftitle'] = $func->format_string($video['title']); $relate['title'] = trim(strip_tags(str_replace('"', '"', html_entity_decode($video['title'])))); $relate['id_you'] = $video['id_you']; $relate['img'] = 'https://img.youtube.com/vi/' . $relate['id_you'] . '/mqdefault.jpg'; $relate['encode_img'] = bin2hex($func->str_encode($relate['img'], 'ngocgiac')); $relate['id_you_encode'] = bin2hex($func->str_encode($relate['id_you'], 'ngocgiac')); $list2[] = $relate; } } $nav3 = ''; $nextPageToken = $arr_xml['nextPageToken']; $prevPageToken = $arr_xml['prevPageToken']; if (!empty($prevPageToken) and $prevPageToken != 'null') { $nav3 .= '<li><a class="pagelink" href="?act=video&pageNum3=' . $prevPageToken . '&code=list&cat=' . $CORE->input['cat'] . '">Previous page</a></li>'; } if (!empty($nextPageToken) and $nextPageToken != 'null') { $nav3 .= '<li><a class="pagelink" href="?act=video&pageNum3=' . $nextPageToken . '&code=list&cat=' . $CORE->input['cat'] . '#video-find-other">Next page</a></li>'; } unset($content, $sxml2); $smarty->assign('list2s', $list2); $smarty->assign('nav3', $nav3); $smarty->assign('title',$title); $smarty->assign('description', $title); $smarty->assign('keywords',$title); $smarty->assign('image',$INFO['home_url'].'skin/'.$INFO['skin_folder'].'/img/vidoe-logo.png'); //$smarty->assign('bread',$bread); } function goDetail(){ global $smarty,$CORE,$DB,$func,$INFO,$print; /*$ftitle = $CORE->input['title']; require_once ROOT_PATH.'proxy/Google/Client.php'; require_once ROOT_PATH.'proxy/Google/Service/YouTube.php'; $client = new Google_Client(); $client->setDeveloperKey($INFO['api_key']); $youtube = new Google_Service_YouTube($client);*/ $id = $CORE->input['id']; if(is_numeric($id)) {//local video $DB->query("UPDATE gtdesign_video SET `hit`=`hit`+1 WHERE id='$id'"); $row_check = $DB->fetch_row($DB->query("SELECT * FROM gtdesign_video WHERE id='$id'")); $show_page = 1; $show_user = 0; if($row_check['status']==0){ $show_page = 0; if(isset($_SESSION['user_id']) && $row_check['user_post']==$_SESSION['user_id']){ $show_page = 1; } } if(isset($_SESSION['user_id']) && $row_check['user_post']==$_SESSION['user_id']){ $show_user = 1; } $smarty->assign('show_page',$show_page); $smarty->assign('show_user',$show_user); $row_check['title'] = trim(strip_tags(str_replace('"', '"', html_entity_decode($row_check['title'])))); $row_check['ftitle'] = $func->format_string($row_check['title']); $row_user2 = $DB->fetch_row($DB->query("SELECT fullname,avatar FROM gtdesign_user WHERE id='" . $row_check['uid'] . "' ")); $row_check['user_name'] = $row_user2['fullname']; $row_check['avatar'] = $row_user2['avatar']; $row_check['view'] = $row_check['hit']; $row_check['txt_time'] = $row_check['time_post'] = date('M d Y', $row_check['time']); $row_check['meta_duration'] = ''; if(!empty($row_check['duration'])) { $arr_dura = explode(':', $row_check['duration']); if (count($arr_dura) == 3) { $v_dura = ($arr_dura[0] * 60 * 60) + ($arr_dura[1] * 60) + ($arr_dura[2]); } else { $v_dura = ($arr_dura[0] * 60) + ($arr_dura[1]); } $row_check['meta_duration'] = $func->iso8601_duration($v_dura); } if(!empty($row_check['theloai'])) { $row_check['txt_theloai'] = $INFO['videocat'][$row_check['theloai']][$_SESSION['lang']]; } $row_check['seo_thumbnail'] = $INFO['home_url'].$row_check['img']; $txt_play = trim($row_check['play']); $pos1 = strpos($txt_play, 'youtube.com'); $pos2 = strpos($txt_play, 'dailymotion.com'); $pos3 = strpos($txt_play, 'vimeo.com'); $pos4 = strpos($txt_play, 'cache/hls'); //$pos2 = '<iframe src="https://www.facebook.com/video/embed?video_id=670825519744051" width="500" height="280" style="border:none;overflow:hidden" scrolling="no" frameborder="0" allowTransparency="true"></iframe>' if($pos1!==false || $pos2!==false || $pos3!==false) { $row_check['no_iframe'] = 0; $row_check['player'] = $func->encode_html('<iframe id="player_iframe" src="' . $txt_play . '" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>'); } if($pos4!==false){ $row_check['no_iframe'] = 1; $a_source['poster'] = $row_check['img']; $a_source['file'] = $txt_play; $a_source['label'] = '720p'; $a_source['type'] = 'application/x-mpegURL'; $list_source[] = $a_source; $show_video = $func->get_video_js($list_source,''); $row_check['player'] = $func->encode_html($show_video); } $row_check['des'] = preg_replace('@(https?://([-\w\.]+[-\w])+(:\d+)?(/([\w/_\.#-]*(\?\S+)?[^\.\s])?)?)@', '<a href="$1" target="_blank">$1</a>', $row_check['des']); $row_check['des'] = preg_replace("/\r|\n/", "<br/>", $row_check['des']); $row_check['time'] = date('F j Y', $row_check['time']); //related $list_related2 = array(); $q_video_user = $DB->query("SELECT * FROM gtdesign_video WHERE uid = '".$row_check['uid']."' AND id <> '".$row_check['id']."' AND status='1' ORDER BY time DESC LIMIT 0,25 "); while($r_video_user = $DB->fetch_row($q_video_user)){ $relate['ftitle'] = $func->format_string($r_video_user['title']); $relate['title'] = trim(strip_tags(str_replace('"','"',html_entity_decode($r_video_user['title'])))); $relate['img'] = $r_video_user['img']; if(strpos($r_video_user['img'],'dmcdn.net')!==false) { $relate['img'] = 'https://img.123vid.top/image.php?file=' . base64_encode($r_video_user['img']) . '&w=686&h=386'; } $relate['uid'] = $row_check['uid']; $relate['user_post'] = $row_check['user_name']; $relate['id'] = $relate['id_encode'] = $r_video_user['id']; $relate['duration'] = $r_video_user['duration']; $list_related2[] = $relate; } } $smarty->assign('title', trim(strip_tags(str_replace('"', '"', html_entity_decode($row_check['title']))))); $smarty->assign('description', trim(strip_tags(str_replace('"', '"', html_entity_decode($row_check['des']))))); $smarty->assign('detail', $row_check); $smarty->assign('list_related2',$list_related2); //$smarty->assign('title', $row_check['title']); $smarty->assign('image', $row_check['seo_thumbnail']); //$smarty->assign('description', $row_check['des']); $smarty->assign('keywords',$row_check['title']); $smarty->assign('cur_url',$func->current_url()); } 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 video(); ?>