LoremPizza commited on
Commit
d85fcb6
·
verified ·
1 Parent(s): f506922

Update test.py

Browse files
Files changed (1) hide show
  1. test.py +31 -0
test.py CHANGED
@@ -126,6 +126,37 @@ async def get_film():
126
  url1 = quote(url)
127
  return url,url1
128
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
129
  if __name__ == "__main__":
130
  import uvicorn
131
  uvicorn.run(app, host="0.0.0.0", port=8000)
 
126
  url1 = quote(url)
127
  return url,url1
128
 
129
+
130
+
131
+
132
+
133
+
134
+ @app.get('/proxy/{path:segment}')
135
+ def proxy_m3u8(segment: str):
136
+ # Base URL of the original M3U8
137
+ base_url = "https://vixcloud.co/playlist/"
138
+
139
+ # Append requested segment
140
+ full_url = f"{base_url}{segment}?{request.query_string.decode('utf-8')}"
141
+
142
+ # Fetch the requested content
143
+ headers = {'User-Agent': 'Mozilla/5.0'} # Add headers if required
144
+ resp = requests.get(full_url, headers=headers)
145
+
146
+ # Return the content with the correct content type
147
+ return Response(resp.content, content_type=resp.headers.get('Content-Type', 'application/vnd.apple.mpegurl'))
148
+
149
+
150
+
151
+
152
+
153
+
154
+
155
+
156
+
157
+
158
+
159
+
160
  if __name__ == "__main__":
161
  import uvicorn
162
  uvicorn.run(app, host="0.0.0.0", port=8000)