Spaces:
Running
Running
Restore e80f9c8: vtv_api.py
Browse files- vtv_api.py +4 -12
vtv_api.py
CHANGED
|
@@ -58,7 +58,8 @@ VTVGO_FAILOVER = {
|
|
| 58 |
}
|
| 59 |
|
| 60 |
# ===== Channels that should use xemtv.net scraping (not VTVGo failover) =====
|
| 61 |
-
# VTV6
|
|
|
|
| 62 |
XEMTV_ONLY_CHANNELS = {"vtv6", "vtv10"}
|
| 63 |
|
| 64 |
# ===== LAST RESORT: fptplay CDN URLs (need proxy for referer) =====
|
|
@@ -72,7 +73,7 @@ FPTPLAY_URLS = {
|
|
| 72 |
"vtv7": "https://live.fptplay53.net/fnxhd1/vtv7hd_vhls.smil/chunklist_b5000000.m3u8",
|
| 73 |
"vtv8": "https://live.fptplay53.net/epzhd1/vtv8hd_vhls.smil/chunklist.m3u8",
|
| 74 |
"vtv9": "https://live.fptplay53.net/fnxhd1/vtv9hd_vhls.smil/chunklist.m3u8",
|
| 75 |
-
"vtv10": "https://live
|
| 76 |
}
|
| 77 |
|
| 78 |
_vtv_cache = {}
|
|
@@ -166,17 +167,8 @@ def fetch_vtv_stream(channel_id):
|
|
| 166 |
if cached is not None:
|
| 167 |
return cached
|
| 168 |
|
| 169 |
-
# --- VTV6: xemtv.net scraping
|
| 170 |
-
# --- VTV10: xemtv returns vtvcantho (403), skip to fptplay CDN directly ---
|
| 171 |
if channel_id in XEMTV_ONLY_CHANNELS:
|
| 172 |
-
if channel_id == "vtv10":
|
| 173 |
-
# VTV10: xemtv.net returns dead vtvcantho URL (403), use fptplay CDN directly
|
| 174 |
-
fpt_url = FPTPLAY_URLS.get(channel_id)
|
| 175 |
-
if fpt_url:
|
| 176 |
-
_set_cache(channel_id, fpt_url)
|
| 177 |
-
return fpt_url
|
| 178 |
-
_set_cache(channel_id, None)
|
| 179 |
-
return None
|
| 180 |
xemtv_url = fetch_xemtv_stream(channel_id)
|
| 181 |
if xemtv_url:
|
| 182 |
_set_cache(channel_id, xemtv_url)
|
|
|
|
| 58 |
}
|
| 59 |
|
| 60 |
# ===== Channels that should use xemtv.net scraping (not VTVGo failover) =====
|
| 61 |
+
# VTV6: user wants xemtv.net source
|
| 62 |
+
# VTV10: separate channel, NOT canthotv - get from xemtv.net
|
| 63 |
XEMTV_ONLY_CHANNELS = {"vtv6", "vtv10"}
|
| 64 |
|
| 65 |
# ===== LAST RESORT: fptplay CDN URLs (need proxy for referer) =====
|
|
|
|
| 73 |
"vtv7": "https://live.fptplay53.net/fnxhd1/vtv7hd_vhls.smil/chunklist_b5000000.m3u8",
|
| 74 |
"vtv8": "https://live.fptplay53.net/epzhd1/vtv8hd_vhls.smil/chunklist.m3u8",
|
| 75 |
"vtv9": "https://live.fptplay53.net/fnxhd1/vtv9hd_vhls.smil/chunklist.m3u8",
|
| 76 |
+
"vtv10": "https://live.fptplay53.net/fnxch2/vtvcantho_abr.smil/chunklist.m3u8",
|
| 77 |
}
|
| 78 |
|
| 79 |
_vtv_cache = {}
|
|
|
|
| 167 |
if cached is not None:
|
| 168 |
return cached
|
| 169 |
|
| 170 |
+
# --- VTV6 & VTV10: Always use xemtv.net scraping ---
|
|
|
|
| 171 |
if channel_id in XEMTV_ONLY_CHANNELS:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 172 |
xemtv_url = fetch_xemtv_stream(channel_id)
|
| 173 |
if xemtv_url:
|
| 174 |
_set_cache(channel_id, xemtv_url)
|