Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- ini_set('user_agent', 'iTunes-AppleTV/4.1');
- if(empty($_GET["f"])) {
- die;
- } else {
- $f = $_GET["f"];
- // Get file from URL that is in $f
- $m3u8 = file_get_contents($f);
- // Parse URL from input
- $domain = parse_url($f);
- $scheme = $domain['scheme'];
- $host = $domain['host'];
- $path = $domain['path'];
- // Get file from URL
- $file = basename($domain['path']);
- // Remove file from path
- $path = preg_replace("/$file/",'',$domain['path']);
- // Put URL back together without filename
- $baseUrl = $scheme . "://" . $host . $path;
- // Pull out .m3u8 from file and replace with proxy php
- $m3u8 = preg_replace('/^(?!\#)(.*\.m3u8).*/m',"http://yourserver.com/m3u8_fix.php?f=$baseUrl$1",$m3u8);
- // Pull out .ts files from final m3u8 and make sure they point at their CDN
- $m3u8 = preg_replace('/^(.*\.ts).*/m',"$baseUrl$1",$m3u8);
- // Removing their key redirect and replacing with other server IP
- $m3u8 = preg_replace('/nlsk.neulion.com/m', "192.241.136.149",$m3u8);
- $m3u8 = preg_replace('/http:\/\/nlsk[0-9]{1,3}.neulion.com/m', "192.241.136.149",$m3u8);
- // Set headers for m3u8 file we're returning to browser
- header("Content-type: application/x-mpegURL");
- header("Content-Disposition: attachment; filename=$file");
- header("Pragma: no-cache");
- header("Expires: 0");
- echo $m3u8;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement