LoremPizza commited on
Commit
a9e66a8
·
verified ·
1 Parent(s): 62cfa2a

Update test.py

Browse files
Files changed (1) hide show
  1. test.py +6 -10
test.py CHANGED
@@ -131,24 +131,20 @@ async def get_film():
131
 
132
 
133
 
134
- @app.get('/proxy/{path}')
135
- def proxy_m3u8(path: str, request: Request):
136
  # Base URL of the original M3U8
137
  base_url = "https://vixcloud.co/playlist/"
138
 
139
- # Append requested path segment
140
- full_url = f"{base_url}{path}?{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
 
 
131
 
132
 
133
 
134
+ @app.get("/proxy/{segment:path}")
135
+ async def proxy_m3u8(segment: str, request: Request):
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_params}"
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(content=resp.content, media_type=resp.headers.get('Content-Type', 'application/vnd.apple.mpegurl'))
 
 
 
 
148
 
149
 
150