Mr_hEx

download TS file from m3u8 and save it as mp4

May 30th, 2021 (edited)
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.69 KB | None | 0 0
  1. import requests , os , tqdm
  2.  
  3. #CMD : pip install tqdm
  4.  
  5. URL = input("URL please : ")
  6. fileNameOutput = input("Output FileName : ")
  7. r = requests.get(URL)
  8.  
  9.  
  10. def toArray(STR):
  11.     out = []
  12.     buff = []
  13.  
  14.     for c in STR:
  15.         if c == '\n':
  16.             out.append(''.join(buff))
  17.             buff = []
  18.         else:
  19.             buff.append(c)
  20.     else:
  21.         if buff:
  22.            out.append(''.join(buff))
  23.     return  out
  24.  
  25.  
  26. StrtoArray = toArray(r.text)
  27.  
  28. urls = []
  29.  
  30. for x in StrtoArray:
  31.     if ".ts" in x:
  32.         urls.append(x)
  33.  
  34. for x in tqdm.tqdm(urls, ncols= 70):
  35.     os.system('curl -s http://website.com/{} >> {}.mp4'.format(x,fileNameOutput.replace(" ", "_")))
  36. print('')
Add Comment
Please, Sign In to add comment