bep40 commited on
Commit
20bb74f
·
verified ·
1 Parent(s): 1a5526c

Upload vtv_api.py

Browse files
Files changed (1) hide show
  1. vtv_api.py +5 -15
vtv_api.py CHANGED
@@ -58,11 +58,11 @@ VTVGO_FAILOVER = {
58
  }
59
 
60
  # ===== Channels that should use xemtv.net scraping (not VTVGo failover) =====
61
- # VTV6: xemtv.net scraping (returns fptplay CDN URL)
62
- # VTV10: xemtv returns dead vtvcantho URL (403), use fptplay CDN directly
63
  XEMTV_ONLY_CHANNELS = {"vtv6", "vtv10"}
64
 
65
  # ===== LAST RESORT: fptplay CDN URLs (need proxy for referer) =====
 
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,9 +150,8 @@ 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: xemtv.net scraping -> fptplay URL (proxied)
154
- 3. VTV10: fptplay CDN directly (xemtv returns dead vtvcantho URL)
155
- 4. VTVPrime: try xemtv, else None (paid channel)
156
  """
157
  channel_id = channel_id.lower().strip()
158
  name_map = {
@@ -168,17 +167,8 @@ def fetch_vtv_stream(channel_id):
168
  if cached is not None:
169
  return cached
170
 
171
- # --- VTV6: xemtv.net scraping ---
172
- # --- VTV10: fptplay CDN directly (xemtv returns dead vtvcantho URL 403) ---
173
  if channel_id in XEMTV_ONLY_CHANNELS:
174
- if channel_id == "vtv10":
175
- # VTV10: use fptplay CDN directly, skip dead xemtv
176
- fpt_url = FPTPLAY_URLS.get(channel_id)
177
- if fpt_url:
178
- _set_cache(channel_id, fpt_url)
179
- return fpt_url
180
- _set_cache(channel_id, None)
181
- return None
182
  xemtv_url = fetch_xemtv_stream(channel_id)
183
  if xemtv_url:
184
  _set_cache(channel_id, xemtv_url)
 
58
  }
59
 
60
  # ===== Channels that should use xemtv.net scraping (not VTVGo failover) =====
61
+ # VTV6, VTV10: xemtv.net scraping (returns fptplay CDN URLs that need proxying)
 
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
  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()
157
  name_map = {
 
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)