PW Akshay

Generation

generate functionMon, 05 Dec 2022

Program to stream m3u8 url to youtube in python

import m3u8 import ffmpy import requests import youtube_dl def stream2youtube(stream_url, youtube_url): m3u8_obj = m3u8.load(stream_url) ts_list = [] for x in m3u8_obj.segments: ts_list.append(x.uri) if ts_list: for t in ts_list: if not t.startswith('http'): print(t) url = stream_url.replace(stream_url.split('/')[-1], t) r = requests.get(url, allow_redirects=True) with open(t, 'wb') as f: f.write(r.content) else: continue try: stream_url.split('/')[-1] ff = ffmpy.FFmpeg( inputs={stream_url.split('/')[-1]: None}, outputs={'output.mp

Questions about programming?Chat with your personal AI assistant