<?php
$link = isset($_GET['url']) ? $_GET['url'] : '';
$page = curl($link);
$request = parse_url($link);
$type = GetRegexValue($page,'#var\sMOVIE_TYPE\s=\s"(.*?) $ident = GetRegexValue($page,'#var\sIDENTIFIER\s=\s"(.*?) $id = GetRegexValue($page,'#var MOVIE_ID\s=\s(\d+ $name = GetRegexValue($page,'#meta itemprop="name" content="(.*?) $cuid = GetRegexValue($page,'#var\sPLAYER_CUID\s=\s"([^"]+) $qual = GetRegexValue($page,'#<li><b>Качество:<\/b>([^>]+)<\/l $time_movie = GetRegexValue($page,'#itemprop="duration">([^>]+)<\/span><\/l $desc = GetRegexValue($page,'#itemprop="description">([^>]+)<\/di $lang = GetRegexValue($page,'#<li><b>Перевод:<\/b>([^>]+)<\/l $img = GetRegexValue($page,'#<div class="poster">\s+<img src="([^"]+)"#si') $url = $request['scheme'].'://'.$request['host'].'/user_data.js?page=movie&movie_id='.$id.'&cuid='.$cuid.'&device=DESKTOP';
$page = curl($url);
$value = preg_match('#escape\(r\)\)\}\((.*?)if(!empty($value)){ preg_match('#"(.*?)",(\d+),"(.*?)",(\d+),(\d+),(\d $key = JsUnpack($val[1],$val[2],$val[3],$val[4],$val[5],$val[6]);
$hash = GetRegexValue($key ,'#var\smarx13_vod_hash\s=\s"([^"]+) $time = GetRegexValue($key ,'#var\smarx13_vod_time\s=\s"([^"]+) }else {
$json = json_decode($page,true);
$hash = $json['vod_hash'];
$time = $json['vod_time'];
}
if(!empty($hash) || (!empty($time))){ $url_const = $request['scheme'].'://'.$request['host'].'/vod/'.$id.'?identifier='.$ident.'&player_type=new&file_type=hls&st='.$hash.'&e='.$time;
}else echo '<b>Ошибка! Не найдены параметры $time и $hash</b>';$data = curl($url_const);$split = explode('|',$data);$json = json_decode($split[1],1);echo '<center><b>'.mb_strtoupper($name).'</b></center><hr>';if($type == 'films'){
$url = explode(',',implode(',',explode(' or ', $split[1])));
for($i=0; $i<count($url);$i++){
$url[$i] = preg_replace('#\[(\d+p) echo $url[$i].'<br>';
}
echo '<hr>';
} else if($type == 'serials'){
if(strpos(@$json[0]['title'],'сезон') === false){foreach($json as $key => $val){
echo '<span style="color:blue"><b>'.@$val['title'].'</b></span><br>'; $url = explode(',',implode(',',explode(' or ', $val['file'])));
for($i=0; $i<count($url);$i++){
$url[$i] = preg_replace('#\[(\d+p) echo $url[$i].'<br>';
}
echo '<hr>';
}
}else{
foreach($json as $k => $v){
echo '<center><span style="color:red"><b>'.$v['title'].'</b></span></center><hr>';
foreach($v['folder'] as $key => $val){
echo '<span style="color:blue"><b>'.$val['title'].'</b></span><br>';
$url = explode(',',implode(',',explode(' or ', $val['file'])));for($i=0; $i<count($url);$i++){
$url[$i] = preg_replace('#\[(\d+p) echo $url[$i].'<br>';
}
echo '<hr>';
}
}
}
}else if($type == 'tv'){
if(strpos($json[0]['title'],'сезон') === false){foreach($json as $key => $val){
echo '<span style="color:blue"><b>'.$val['title'].'</b></span><br>'; $url = explode(',',implode(',',explode(' or ', $val['file'])));
for($i=0; $i<count($url);$i++){
$url[$i] = preg_replace('#\[(\d+p) echo $url[$i].'<br>';
}
echo '<hr>';
}
}else{
foreach($json as $k => $v){
echo '<center><span style="color:red"><b>'.$v['title'].'</b></span></center><hr>';
foreach($v['folder'] as $key => $val){
echo '<span style="color:blue"><b>'.$val['title'].'</b></span><br>';
$url = explode(',',implode(',',explode(' or ', $val['file'])));for($i=0; $i<count($url);$i++){
$url[$i] = preg_replace('#\[(\d+p) echo $url[$i].'<br>';
}
echo '<hr>';
}
}
}
}function curl($url, $post='', $mode=array()) {
$defaultmode = array('charset' => 'utf-8', 'ssl' => 1, 'cookie' => 1, 'headers' => 0, 'useragent' => 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0');
foreach ($defaultmode as $k => $v) {
if (!isset($mode[$k]) ) {
$mode[$k] = $v;
}
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, $mode['headers']);
curl_setopt($ch, CURLOPT_REFERER, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, $mode['useragent']);
curl_setopt($ch, CURLOPT_ENCODING, $mode['charset']);
curl_setopt($ch, CURLOPT_AUTOREFERER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
if ($post) {
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
}
if ($mode['cookie']) {
curl_setopt($ch, CURLOPT_COOKIEFILE, dirname(__FILE__).'/cookies.txt');
curl_setopt($ch, CURLOPT_COOKIEJAR, dirname(__FILE__).'/cookies.txt');
}
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
if ($mode['ssl']) {
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
}
$data = curl_exec($ch);
curl_close($ch);
return $data;
}function GetRegexValue($text, $pattern, $group=1) {
if (preg_match($pattern, $text, $matches))
return $matches[$group];
return "";
}function b64c($d, $e, $f) {
$g = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ+/';
$h = substr($g, 0, $e);
$i = substr($g, 0, $f);
$d = strrev($d);
$j = 0;
for($c=0; $c<strlen($d); $c++) {
$j += strpos($h, $d[$c]) * pow($e, $c);
}
$k = '';
while ($j > 0) {
$k = $i[$j % $f] . $k;
$j = ($j - ($j % $f)) / $f;
}
return $k ? $k : '0';
}
function JsUnpack($h, $u, $n, $t, $e, $r) {
$r = "";
for ($i=0; $i < strlen($h); $i++) {
$s = "";
while ($h[$i] !== $n[$e]) {
$s .= $h[$i];
$i++;
}
for ($j=0; $j < strlen($n); $j++) $s = str_replace($n[$j], $j, $s);
$ch = chr(b64c($s, $e, 10) - $t);
$r .= $ch;
}
return $r;
}
?>