Spaces:
Paused
Paused
Update test.py
Browse files
test.py
CHANGED
|
@@ -16,6 +16,16 @@ def fetch_m3u8(url):
|
|
| 16 |
response.raise_for_status() # Raise an error for bad responses
|
| 17 |
return response.text
|
| 18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
@app.get("/clone/manifest.m3u8")
|
| 21 |
async def clone_m3u8(d: str = None):
|
|
|
|
| 16 |
response.raise_for_status() # Raise an error for bad responses
|
| 17 |
return response.text
|
| 18 |
|
| 19 |
+
@app.get("/vixcloud/manifest.m3u8")
|
| 20 |
+
async def clone2_m3u8(d:str,token:str,expires:str,h:str)
|
| 21 |
+
try:
|
| 22 |
+
m3u8 = f'{d}?token={token}&expires={expires}&h={h}'
|
| 23 |
+
print(m3u8)
|
| 24 |
+
m3u8_content = fetch_m3u8(d)
|
| 25 |
+
return StreamingResponse(content=m3u8_content, media_type='application/vnd.apple.mpegurl')
|
| 26 |
+
except requests.RequestException as e:
|
| 27 |
+
print(f"Failed to fetch M3U8 file: {e}")
|
| 28 |
+
raise HTTPException(status_code=404, detail="M3U8 content not found")
|
| 29 |
|
| 30 |
@app.get("/clone/manifest.m3u8")
|
| 31 |
async def clone_m3u8(d: str = None):
|