import http.server import socketserver import mimetypes # Add custom MIME types mimetypes.add_type('application/x-mpegURL', '.m3u8') mimetypes.add_type('video/MP2T', '.ts') PORT = 8000 Handler = http.server.SimpleHTTPRequestHandler with socketserver.TCPServer(("", PORT), Handler) as httpd: print("serving at port", PORT) httpd.serve_forever()