Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if(isset($_POST["m3u8"])&&strlen($_POST["m3u8"])){
- //https://cf-hls-media.sndcdn.com/playlist/jT6vVCgeToaf.128.mp3/playlist.m3u8
- $mpd=file_get_contents($_POST["m3u8"]);
- if(strlen($mpd)>40){
- $lns=explode("\n",$mpd);
- $udat="";
- foreach($lns as $ln){
- if(substr($ln,0,1)!="#"&&strlen($ln)>7)
- $udat.=",".$ln;
- }
- $udat=substr($udat,1);
- }else exit("error: ".$mpd);
- }elseif(isset($_POST["comu"])&&strlen($_POST["comu"])){
- $udat=$_POST["comu"];
- }
- if(isset($udat)){
- $fns="".dechex(random_int(0 ,14400))."_".dechex(time());
- $frst=substr($udat,0,strpos($udat,","));
- if($qr=strpos($frst,"?")) $frst=substr($frst,0,$qr);
- if($ld=strrpos($frst,".")) $fns.=substr($frst,$ld);
- file_put_contents($fns.".csv",$udat);
- if($_["SERVER_PORT"]*1==443) $sL="s"; else $sL="";
- echo 'Result file: <a href="http'$sL.'://'.$_SERVER["HTTP_HOST"].'/'.$_SERVER["SCRIPT_NAME"].'/'.$fns.'"> '.$fns.'</a><br><a href="?">back to form</a>';
- }elseif(isset($_SERVER["PATH_INFO"])&&strlen($_SERVER["PATH_INFO"])>7){
- $odat="";
- $urls=explode(",",file_get_contents(substr($_SERVER["PATH_INFO"],1).'.csv'));
- foreach($urls as $url){
- $odat.=file_get_contents($url);
- }
- $file_info = new finfo(FILEINFO_MIME);
- $mime_type = $file_info->buffer($odat);
- header("Content-Type: ".$mime_type);
- echo $odat;
- }else
- echo '<html>
- <head>
- <title>MediaMash</title>
- </head>
- <body>
- MediaMash!<br><br>
- This proxy takes those irksome HLS .m3u8 playlists and mashes all those chunks together into one big media file.
- <br>
- It's very basic, it literally just appends their file data together, so don't be surprised if it doesn't work sometimes.
- <br>
- <br>
- <form method="POST" enctype="application/x-form-url-encoded">
- Input url to a HLS stream .m3u8 playlist:
- <input type="text" name="m3u8"><br>
- OR<br>
- Input comma separated individual media urls to mash together (must be same file type and bitrate):
- <br>
- <textarea name="comu" cols=250 rows=50 ></textarea>
- <br>
- <input type="submit" value="mash!">
- </form></body></html>';
- ?>
Add Comment
Please, Sign In to add comment