Spaces:
Running
Running
Fix VTV proxy: manifest 5s, segment 8s timeout
Browse files- vtv_api.py +2 -2
vtv_api.py
CHANGED
|
@@ -206,7 +206,7 @@ def proxy_vtv_m3u8(url: str = Query(...)):
|
|
| 206 |
headers["Referer"] = "https://vtvgo.vn/"
|
| 207 |
elif "xemtv" in url:
|
| 208 |
headers["Referer"] = "https://hd.xemtv.net/"
|
| 209 |
-
r = requests.get(url, headers=headers, timeout=
|
| 210 |
if r.status_code != 200:
|
| 211 |
return Response(status_code=502, content=f"upstream error: {r.status_code}")
|
| 212 |
content = r.text
|
|
@@ -237,7 +237,7 @@ def proxy_vtv_segment(url: str = Query(...)):
|
|
| 237 |
headers["Origin"] = "https://fptplay.vn"
|
| 238 |
elif "vtvgolive" in url or "vtvdigital" in url:
|
| 239 |
headers["Referer"] = "https://vtvgo.vn/"
|
| 240 |
-
r = requests.get(url, headers=headers, timeout=
|
| 241 |
if r.status_code != 200:
|
| 242 |
return Response(status_code=502, content=f"upstream error: {r.status_code}")
|
| 243 |
data = r.content
|
|
|
|
| 206 |
headers["Referer"] = "https://vtvgo.vn/"
|
| 207 |
elif "xemtv" in url:
|
| 208 |
headers["Referer"] = "https://hd.xemtv.net/"
|
| 209 |
+
r = requests.get(url, headers=headers, timeout=5, allow_redirects=True)
|
| 210 |
if r.status_code != 200:
|
| 211 |
return Response(status_code=502, content=f"upstream error: {r.status_code}")
|
| 212 |
content = r.text
|
|
|
|
| 237 |
headers["Origin"] = "https://fptplay.vn"
|
| 238 |
elif "vtvgolive" in url or "vtvdigital" in url:
|
| 239 |
headers["Referer"] = "https://vtvgo.vn/"
|
| 240 |
+
r = requests.get(url, headers=headers, timeout=8, allow_redirects=True, stream=True)
|
| 241 |
if r.status_code != 200:
|
| 242 |
return Response(status_code=502, content=f"upstream error: {r.status_code}")
|
| 243 |
data = r.content
|