bep40 commited on
Commit
1a26ff4
·
verified ·
1 Parent(s): 3174a64

Upload vtv_api.py

Browse files
Files changed (1) hide show
  1. vtv_api.py +6 -20
vtv_api.py CHANGED
@@ -58,13 +58,8 @@ VTVGO_FAILOVER = {
58
  }
59
 
60
  # ===== Channels that should use xemtv.net scraping (not VTVGo failover) =====
61
- # VTV6: user wants xemtv.net source (works via fptplay CDN)
62
- # VTV10: launched 2026-03-30, currently NO working free stream URL exists
63
- # - VTVGo: 404 (not available)
64
- # - fptplay: 403 (blocked)
65
- # - xemtv.net: returns vtvcantho URL which is also 403
66
- # → VTV10 is marked as offline until a working stream is found
67
- XEMTV_ONLY_CHANNELS = {"vtv6"}
68
 
69
  # ===== LAST RESORT: fptplay CDN URLs (need proxy for referer) =====
70
  FPTPLAY_URLS = {
@@ -77,7 +72,7 @@ FPTPLAY_URLS = {
77
  "vtv7": "https://live.fptplay53.net/fnxhd1/vtv7hd_vhls.smil/chunklist_b5000000.m3u8",
78
  "vtv8": "https://live.fptplay53.net/epzhd1/vtv8hd_vhls.smil/chunklist.m3u8",
79
  "vtv9": "https://live.fptplay53.net/fnxhd1/vtv9hd_vhls.smil/chunklist.m3u8",
80
- # VTV10: no working fptplay URL (all return 403 as of 2026)
81
  }
82
 
83
  _vtv_cache = {}
@@ -154,9 +149,8 @@ def fetch_vtv_stream(channel_id):
154
  Fetch m3u8 stream URL for a VTV channel.
155
  Priority:
156
  1. VTV1-VTV5, VTV7-VTV9: VTVGo failover CDN (no referer needed)
157
- 2. VTV6: xemtv.net scraping (user requirement) -> fptplay URL (proxied)
158
- 3. VTV10: NO working stream (launched 2026-03-30, all sources blocked)
159
- 4. VTVPrime: try xemtv, else None (paid channel)
160
  """
161
  channel_id = channel_id.lower().strip()
162
  name_map = {
@@ -172,7 +166,7 @@ def fetch_vtv_stream(channel_id):
172
  if cached is not None:
173
  return cached
174
 
175
- # --- VTV6: Always use xemtv.net scraping ---
176
  if channel_id in XEMTV_ONLY_CHANNELS:
177
  xemtv_url = fetch_xemtv_stream(channel_id)
178
  if xemtv_url:
@@ -185,14 +179,6 @@ def fetch_vtv_stream(channel_id):
185
  _set_cache(channel_id, None)
186
  return None
187
 
188
- # --- VTV10: No working stream URL currently available ---
189
- # VTV10 launched 2026-03-30. All sources return 403/404:
190
- # VTVGo failover: 404, fptplay: 403, xemtv: returns vtvcantho (403)
191
- # Remove VTV10 from XEMTV_ONLY_CHANNELS until a working stream is found.
192
- if channel_id == "vtv10":
193
- _set_cache(channel_id, None)
194
- return None
195
-
196
  # --- VTV1-VTV5, VTV7-VTV9: VTVGo failover ---
197
  if channel_id in VTVGO_FAILOVER:
198
  result = VTVGO_FAILOVER[channel_id]
 
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
  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.fptplay53.net/fnxch2/vtvcantho_abr.smil/chunklist.m3u8",
76
  }
77
 
78
  _vtv_cache = {}
 
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 -> fptplay URL (proxied)
153
+ 3. VTVPrime: try xemtv, else None (paid channel)
 
154
  """
155
  channel_id = channel_id.lower().strip()
156
  name_map = {
 
166
  if cached is not None:
167
  return cached
168
 
169
+ # --- VTV6, VTV10: Always use xemtv.net scraping ---
170
  if channel_id in XEMTV_ONLY_CHANNELS:
171
  xemtv_url = fetch_xemtv_stream(channel_id)
172
  if xemtv_url:
 
179
  _set_cache(channel_id, None)
180
  return None
181
 
 
 
 
 
 
 
 
 
182
  # --- VTV1-VTV5, VTV7-VTV9: VTVGo failover ---
183
  if channel_id in VTVGO_FAILOVER:
184
  result = VTVGO_FAILOVER[channel_id]