Spaces:
Running
Running
Fix: VTV10 stream URL priority
Browse files- vtv_api.py +11 -3
vtv_api.py
CHANGED
|
@@ -62,7 +62,6 @@ VTVGO_FAILOVER = {
|
|
| 62 |
XEMTV_ONLY_CHANNELS = {"vtv6", "vtv10"}
|
| 63 |
|
| 64 |
# ===== LAST RESORT: fptplay CDN URLs (need proxy for referer) =====
|
| 65 |
-
# VTV10 = https://live-a.fptplay53.net/live/media/vtv10/live247-hls-avc/... (verified 2026)
|
| 66 |
FPTPLAY_URLS = {
|
| 67 |
"vtv1": "https://live.fptplay53.net/fnxch2/vtv1hd_abr.smil/chunklist.m3u8",
|
| 68 |
"vtv2": "https://live.fptplay53.net/fnxch2/vtv2hd_abr.smil/chunklist.m3u8",
|
|
@@ -150,7 +149,7 @@ def fetch_vtv_stream(channel_id):
|
|
| 150 |
Fetch m3u8 stream URL for a VTV channel.
|
| 151 |
Priority:
|
| 152 |
1. VTV1-VTV5, VTV7-VTV9: VTVGo failover CDN (no referer needed)
|
| 153 |
-
2. VTV6, VTV10: xemtv.net scraping -> fptplay URL (proxied)
|
| 154 |
3. VTVPrime: try xemtv, else None (paid channel)
|
| 155 |
"""
|
| 156 |
channel_id = channel_id.lower().strip()
|
|
@@ -167,8 +166,17 @@ def fetch_vtv_stream(channel_id):
|
|
| 167 |
if cached is not None:
|
| 168 |
return cached
|
| 169 |
|
| 170 |
-
# --- VTV6
|
|
|
|
| 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)
|
|
|
|
| 62 |
XEMTV_ONLY_CHANNELS = {"vtv6", "vtv10"}
|
| 63 |
|
| 64 |
# ===== LAST RESORT: fptplay CDN URLs (need proxy for referer) =====
|
|
|
|
| 65 |
FPTPLAY_URLS = {
|
| 66 |
"vtv1": "https://live.fptplay53.net/fnxch2/vtv1hd_abr.smil/chunklist.m3u8",
|
| 67 |
"vtv2": "https://live.fptplay53.net/fnxch2/vtv2hd_abr.smil/chunklist.m3u8",
|
|
|
|
| 149 |
Fetch m3u8 stream URL for a VTV channel.
|
| 150 |
Priority:
|
| 151 |
1. VTV1-VTV5, VTV7-VTV9: VTVGo failover CDN (no referer needed)
|
| 152 |
+
2. VTV6, VTV10: xemtv.net scraping (user requirement) -> fptplay URL (proxied)
|
| 153 |
3. VTVPrime: try xemtv, else None (paid channel)
|
| 154 |
"""
|
| 155 |
channel_id = channel_id.lower().strip()
|
|
|
|
| 166 |
if cached is not None:
|
| 167 |
return cached
|
| 168 |
|
| 169 |
+
# --- VTV6: xemtv.net scraping (returns working fptplay URL) ---
|
| 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)
|