PW Akshay

Generation

generate functionSun, 04 Dec 2022

stream with m3u8 to rtmp in python (no ffmpeg)

def stream(url, rtmp): import time, uuid, urllib, os, signal, sys, requests, json, subprocess session = str(uuid.uuid1()) while True: response = requests.get(url, headers={'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.116 Safari/537.36 OPR/67.0.3575.53'}) ts = list(map(lambda x: x.split('\n')[0], response.text.split('#EXTINF')))[1:] ts = list(map(lambda x: x.split(',')[1], ts)) ts = list(map(lambda x: 'http://' + url.split('/')[2] + x, ts)) ts = list(map(lambda x: x.split('?')[0], ts)) with open('/tmp/{

Questions about programming?Chat with your personal AI assistant