Mr_hEx icon

download TS file from m3u8 and save it as mp4

Mr_hEx | PRO | 05/31/21 03:19:43 PM UTC (Edited) | 0 ⭐ | 401 👁️ | Never ⏰ | []
Python |

690 B

|

None

|

0 👍

/

0 👎

import requests , os , tqdm
 
#CMD : pip install tqdm
 
URL = input("URL please : ")
fileNameOutput = input("Output FileName : ")
r = requests.get(URL)
 
 
def toArray(STR):
    out = []
    buff = []
 
    for c in STR:
        if c == '\n':
            out.append(''.join(buff))
            buff = []
        else:
            buff.append(c)
    else:
        if buff:
           out.append(''.join(buff))
    return  out
 
 
StrtoArray = toArray(r.text)
 
urls = []
 
for x in StrtoArray:
    if ".ts" in x:
        urls.append(x)
 
for x in tqdm.tqdm(urls, ncols= 70):
    os.system('curl -s http://website.com/{} >> {}.mp4'.format(x,fileNameOutput.replace(" ", "_")))
print('')

Comments