Program to stream m3u8 url to rtmp in python using rtmpy.
def rtmpm3u8(url, rtmp_url): rtmp_conn = rtmpy.Connection(rtmp_url) rtmp_conn.connect() stream_type='live' rtmp_conn.create_stream(type=stream_type) m3u8_obj = m3u8.loads(requests.get(url).text) master_playlist = m3u8.load(url) for playlist in master_playlist.playlists: print(playlist.uri) segment_urls = [urljoin(url, segment.uri) for segment in playlist.segments] rtmp_conn.publish() for segment_url in segment_urls: segment_obj = requests.get(segment_url).content rtmp_conn.write(segment_obj, timestamp=0)