PW Akshay

Generation

generate functionMon, 05 Dec 2022

Program to live stream m3u8 to youtube in python .

def live_to_youtube(url, api_key, channel_id): r = requests.get(url, stream=True) r.raw.decode_content = True filename = 'tempfile.ts' l = 0 with open(filename, 'wb') as f: for chunk in r.iter_content(chunk_size=1024): if chunk: # filter out keep-alive new chunks f.write(chunk) l += 1 if l >= 60: live_stream(filename, api_key, channel_id) l = 0 f.close()

Questions about programming?Chat with your personal AI assistant