triflix commited on
Commit
031e2f6
·
verified ·
1 Parent(s): b0d2d00

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -0
app.py ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from flask import Flask, Response
2
+ import requests
3
+
4
+ app = Flask(__name__)
5
+
6
+ STREAM_URL = "https://www.youtube.com" # replace with real stream
7
+
8
+ @app.route("/proxy")
9
+ def proxy():
10
+ def generate():
11
+ with requests.get(STREAM_URL, stream=True) as r:
12
+ for chunk in r.iter_content(chunk_size=8192):
13
+ yield chunk
14
+ return Response(generate(), mimetype="video/mp4")
15
+
16
+ if __name__ == "__main__":
17
+ app.run(host="0.0.0.0", port=7860)