Spaces:
Running
Running
Upload app_main.py
Browse files- app_main.py +2 -2
app_main.py
CHANGED
|
@@ -104,9 +104,9 @@ def proxy_page(url: str = Query(...)):
|
|
| 104 |
"""Proxy fetch a page to avoid CORS."""
|
| 105 |
try:
|
| 106 |
r = req.get(url, headers={'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36','Accept-Language':'vi-VN,vi;q=0.9','Referer':'https://hd.xemtv.net/'}, timeout=15)
|
| 107 |
-
return
|
| 108 |
except:
|
| 109 |
-
return
|
| 110 |
|
| 111 |
# Interactions
|
| 112 |
DATA_DIR = '/data' if os.path.isdir('/data') else os.path.join(os.path.dirname(os.path.abspath(__file__)), 'data')
|
|
|
|
| 104 |
"""Proxy fetch a page to avoid CORS."""
|
| 105 |
try:
|
| 106 |
r = req.get(url, headers={'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36','Accept-Language':'vi-VN,vi;q=0.9','Referer':'https://hd.xemtv.net/'}, timeout=15)
|
| 107 |
+
return HTMLResponse(content=r.text)
|
| 108 |
except:
|
| 109 |
+
return HTMLResponse(content='', status_code=502)
|
| 110 |
|
| 111 |
# Interactions
|
| 112 |
DATA_DIR = '/data' if os.path.isdir('/data') else os.path.join(os.path.dirname(os.path.abspath(__file__)), 'data')
|