Spaces:
Running
Running
Fix yt_live.js: proxy fptplay CDN URLs via /api/proxy/m3u8 to bypass Referer check
Browse files- static/yt_live.js +10 -1
static/yt_live.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
// === VNEWS — VTV1-VTV10 LIVE CHANNELS ===
|
| 2 |
// 1. Parses M3U from 3 public IPTV sources (iptv-org, Love4vn, Ykcitus)
|
| 3 |
// 2. Falls back to xemtv.net PHP endpoints for missing/geo-blocked channels
|
|
|
|
| 4 |
// Uses HLS.js with auto-failover between sources
|
| 5 |
|
| 6 |
(function(){
|
|
@@ -121,6 +122,14 @@
|
|
| 121 |
return null;
|
| 122 |
}
|
| 123 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 124 |
async function loadAllStreams(){
|
| 125 |
if(_loading) return;
|
| 126 |
_loading = true;
|
|
@@ -224,7 +233,7 @@
|
|
| 224 |
loadEl.style.display = 'flex';
|
| 225 |
loadEl.innerHTML = '<div class="vtv-spinner"></div>Đang kết nối ' + ch.name + '...';
|
| 226 |
if(_hls){ _hls.destroy(); _hls = null; }
|
| 227 |
-
const urls = STREAMS[chId] || [];
|
| 228 |
if(urls.length === 0){
|
| 229 |
loadEl.style.display = 'none';
|
| 230 |
errEl.style.display = 'flex';
|
|
|
|
| 1 |
// === VNEWS — VTV1-VTV10 LIVE CHANNELS ===
|
| 2 |
// 1. Parses M3U from 3 public IPTV sources (iptv-org, Love4vn, Ykcitus)
|
| 3 |
// 2. Falls back to xemtv.net PHP endpoints for missing/geo-blocked channels
|
| 4 |
+
// 3. Uses /api/proxy/m3u8 for fptplay CDN streams (bypasses Referer check)
|
| 5 |
// Uses HLS.js with auto-failover between sources
|
| 6 |
|
| 7 |
(function(){
|
|
|
|
| 122 |
return null;
|
| 123 |
}
|
| 124 |
|
| 125 |
+
// Wrap fptplay CDN URLs with our proxy to bypass Referer check
|
| 126 |
+
function proxyStreamUrl(url){
|
| 127 |
+
if(url.includes('fptplay53.net') || url.includes('fptplay')){
|
| 128 |
+
return '/api/proxy/m3u8?url=' + encodeURIComponent(url);
|
| 129 |
+
}
|
| 130 |
+
return url;
|
| 131 |
+
}
|
| 132 |
+
|
| 133 |
async function loadAllStreams(){
|
| 134 |
if(_loading) return;
|
| 135 |
_loading = true;
|
|
|
|
| 233 |
loadEl.style.display = 'flex';
|
| 234 |
loadEl.innerHTML = '<div class="vtv-spinner"></div>Đang kết nối ' + ch.name + '...';
|
| 235 |
if(_hls){ _hls.destroy(); _hls = null; }
|
| 236 |
+
const urls = (STREAMS[chId] || []).map(proxyStreamUrl);
|
| 237 |
if(urls.length === 0){
|
| 238 |
loadEl.style.display = 'none';
|
| 239 |
errEl.style.display = 'flex';
|