Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function dd($data)
- {
- echo '<pre>';
- var_dump($data);
- echo '</pre>';
- exit();
- }
- $opts = [
- "http" => [
- "method" => "GET",
- "header" => "Accept: */*\r\n
- Accept-encoding: gzip, deflate, br\r\n
- Accept-language: ru-RU,ru;q=0.9,en-US;q=0.8,en;q=0.7\r\n
- Origin: https://vk.com\r\n
- Referer: https://vk.com/\r\n
- Sec-ch-ua: \"Chromium\";v=\"94\", \"Google Chrome\";v=\"94\", \";Not A Brand\";v=\"99\"\r\n
- Sec-ch-ua-mobile: ?0\r\n
- Sec-ch-ua-platform: \"Windows\"\r\n
- Sec-fetch-dest: empty\r\n
- Sec-fetch-mode: cors\r\n
- Sec-fetch-site: cross-site\r\n
- User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.71 Safari/537.36"
- ]
- ];
- $context = stream_context_create($opts);
- $ee = file_get_contents("https://psv4.vkuseraudio.net/audio/ee/s4_jzslYORe-63YTHpOJ4Moky6jGN5g4eYFfIA/c9Oj4_MDA2MDMx/5dN1RWUWlkYUVKUnM/index.m3u8?extra=gVaP4SWomDKiSZP84WiL6vyytBKbVRbFHhqi7Z3345oEfEzNqURU2e5GFocslJsirVHx9tg8pLDloKoY7HXiNoRTa45FJS8xAaeJ1t3sAUnD3GpBeChHPKYiP9tIuxoqURoK_2VjpTd4n2QG8Z8", false, $context);
- $playlist = explode("\n", $ee);
- $file = '';
- $enc = null;
- $passphrase = null;
- for ($i = 0; $i < count($playlist); $i++) {
- if (preg_match("/URI/si", $playlist[$i]))
- $file = preg_replace("/(.*)URI=\"(.*)key.pub(.*)/si", "$2", $playlist[$i]);
- if (preg_match("/#EXT-X-KEY:METHOD=/si", $playlist[$i])) {
- if (preg_match("/NONE/si", $playlist[$i])) $enc = null;
- else {
- $enc = 'aes';
- if (!$passphrase) {
- $passphrase = file_get_contents(
- trim(str_replace('#EXT-X-KEY:METHOD=AES-128,URI=', "", $playlist[$i]), '"'),
- false,
- $context
- );
- }
- }
- }
- if (preg_match("/#EXTINF:/si", $playlist[$i])) {
- $tmpfile = $file . $playlist[$i + 1];
- $partfile = file_get_contents($tmpfile, false, $context);
- $partname = explode("?", basename($tmpfile))[0];
- file_put_contents('./test/' . $partname, $partfile);
- if ($enc) {
- $cypher = 'AES-128-CBC';
- $ivSize = openssl_cipher_iv_length($cypher);
- $handle = fopen('./test/' . $partname, "rb");
- $iv = fread($handle, $ivSize);
- $ciphered_data = fread($handle, filesize('./test/' . $partname));
- fclose($handle);
- file_put_contents('./test/d_' . $partname, openssl_decrypt(
- $ciphered_data,
- $cypher,
- $passphrase,
- OPENSSL_RAW_DATA,
- $iv
- ));
- break;
- }
- }
- }
Add Comment
Please, Sign In to add comment