= 2) { $deciphers = $deciphers[0][0]; $deciphersObjectVar = $decipherPatterns ; $decipher = explode($deciphers . '={', $decipherScript)[1]; $decipher = str_replace(["\n", "\r"], '', $decipher); $decipher = explode('}};', $decipher)[0]; $decipher = explode('},', $decipher); // Convert deciphers to object $deciphers = []; foreach ($decipher as &$function) { $deciphers[explode(':function', $function)[0]] = explode('){', $function)[1]; } // Convert pattern to array $decipherPatterns = str_replace($deciphersObjectVar . '.', '', $decipherPatterns); $decipherPatterns = str_replace($deciphersObjectVar . '[', '', $decipherPatterns); $decipherPatterns = str_replace(['](a,', '(a,'], '->(', $decipherPatterns); $decipherPatterns = explode(';', $decipherPatterns); $patterns =$decipherPatterns; $deciphers =$deciphers; if (!file_exists(TOOLS_PATH.'sig.php')) { for ($i=0; $i < count($patterns); $i++) { $executes = explode('->', $patterns[$i]); $execute=explode('.', $executes[0]); $number = intval(str_replace(['(', ')'], '', $executes[1])); $execute = $deciphers[$execute[1]]; switch ($execute) { case 'a.reverse()': $processSignature = '$reverse'; break; case 'var c=a[0];a[0]=a[b%a.length];a[b]=c': $processSignature= '$length'; break; case 'var c=a[0];a[0]=a[b%a.length];a[b%a.length]=c': $processSignature= '$lengtha'; break; case 'a.splice(0,b)': $processSignature= '$splice'; break; default: die("\n==== Decipher dictionary was not found ===="); break; } $myfile = fopen(TOOLS_PATH.'sig.php', "a+") or die("Unable to open file!"); if ($i==0) { fwrite($myfile, ' $url, 'width' => $data['width'], 'height' => $data['height'] ); array_push($vidthumb, $values); } // keywords $vidkeywords = array(); if ( isset($streamin_data_json["videoDetails"]["keywords"]) ) { foreach ($streamin_data_json["videoDetails"]["keywords"] as $data) { array_push($vidkeywords, $data); } } // streams if (isset($streamin_data_json["streamingData"])) { if (isset($streamin_data_json["streamingData"]["formats"])) { $strF=$streamin_data_json["streamingData"]["formats"]; } if (isset($streamin_data_json["streamingData"]["adaptiveFormats"])) { $strA=$streamin_data_json["streamingData"]["adaptiveFormats"]; } $vdef = array(); if (isset($strF)) { foreach ($strF as $stream) { if (isset($stream["signatureCipher"])) { parse_str($stream["signatureCipher"],$dturl); $values = array( 'url' => $dturl['url'].'&sig='.sig($dturl['s']), 'itag' => $stream['itag'], 'type' => $stream['mimeType'], 'quality' => $stream['quality'], 'fps' => $stream['fps'], 'resolution' => $stream['qualityLabel'], 'qualityLabel' => $stream['qualityLabel'], 'format' => exformat($stream['itag']) ); array_push($vdef, $values); } else { if (!empty($strF['url'])) { $values = array( 'url' => $strF['url'], ); array_push($vdef, $values); } } } } $aud = array(); $vid = array(); if (isset($strF)) { foreach ($strF as $stream) { if (isset( $stream['url'] )) { if (preg_match('/video/', $stream['mimeType'])) { $url = $stream['url']; $values = array( 'url' => $url, 'itag' => $stream['itag'], 'type' => $stream['mimeType'], 'quality' => $stream['quality'], 'fps' => $stream['fps'], 'resolution' => $stream['qualityLabel'], 'qualityLabel' => $stream['qualityLabel'], 'format' => exformat($stream['itag']), ); array_push($vid, $values); } } } } if (isset($strA)) { foreach ($strA as $stream) { if (isset($stream["signatureCipher"])) { parse_str($stream["signatureCipher"],$dturl); $stream['url']=$dturl['url'].'&sig='.sig($dturl['s']); } if (preg_match('/audio/', $stream['mimeType'])) { $url = $stream['url']; $values = array( 'url' => $url, 'itag' => $stream['itag'], 'type' => $stream['mimeType'], 'quality' => $stream['quality'], 'format' => exformat($stream['itag']), ); array_push($aud, $values); } if (preg_match('/video/', $stream['mimeType'])) { $url = $stream['url']; $values = array( 'url' => $url, 'itag' => $stream['itag'], 'type' => $stream['mimeType'], 'quality' => $stream['quality'], 'fps' => $stream['fps'], 'resolution' => $stream['qualityLabel'], 'qualityLabel' => $stream['qualityLabel'], 'format' => exformat($stream['itag']), ); array_push($vid, $values); } } } } else { $vdef = array(); $aud = array(); $vid = array(); } // $json['title']=$vidtitle; // $json['videoId']=$vidId; // $json['videoThumbnails']=$vidthumb; // $json['description']=$viddes; // $json['publishedText']=$vidpub; // $json['viewCount']=$vidviewCount; // $json['keywords']=$vidkeywords; // $json['author']=$vidauthor; // $json['authorId']=$vidauthorid; // $json['authorUrl']=$vidauthourl; // $json['lengthSeconds']=$vidtime; // $json['liveNow']=$vidisLiveContent; // $json['default']=$vdef; // $json['audio']=$aud; // $json['video']=$vid;