Spaces:
Paused
Paused
Update test.py
Browse files
test.py
CHANGED
|
@@ -131,24 +131,20 @@ async def get_film():
|
|
| 131 |
|
| 132 |
|
| 133 |
|
| 134 |
-
@app.get(
|
| 135 |
-
def proxy_m3u8(
|
| 136 |
# Base URL of the original M3U8
|
| 137 |
base_url = "https://vixcloud.co/playlist/"
|
| 138 |
|
| 139 |
-
# Append requested
|
| 140 |
-
full_url = f"{base_url}{
|
| 141 |
|
| 142 |
# Fetch the requested content
|
| 143 |
headers = {'User-Agent': 'Mozilla/5.0'} # Add headers if required
|
| 144 |
-
resp =
|
| 145 |
|
| 146 |
# Return the content with the correct content type
|
| 147 |
-
return Response(resp.content,
|
| 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 |
|