JAYNESTV commited on
Commit
3367da6
·
verified ·
1 Parent(s): 669f9d0

Upload index.js

Browse files
Files changed (1) hide show
  1. index.js +11 -1
index.js CHANGED
@@ -281,7 +281,17 @@ function extractStream(html) {
281
  }
282
 
283
  const streamUrl = mpdUrl || hlsUrl || mp4Url;
284
- const type = mpdUrl ? 'DASH' : (hlsUrl ? 'HLS' : (mp4Url ? 'MP4' : ''));
 
 
 
 
 
 
 
 
 
 
285
  const drm = clearKey ? 'CLEARKEY' : (licenseUrl ? 'WIDEVINE' : 'NONE');
286
 
287
  return { name, stream_url: streamUrl, type, drm, clearkey: clearKey, license_url: licenseUrl };
 
281
  }
282
 
283
  const streamUrl = mpdUrl || hlsUrl || mp4Url;
284
+
285
+ // Amua "type" kutoka extension HALISI ya streamUrl iliyochaguliwa
286
+ // mwishoni (siyo kutoka variable tofauti) — hii inaepuka hitilafu
287
+ // ya kusema "DASH" wakati URL ni .m3u8 (au kinyume chake) endapo
288
+ // mpdUrl/hlsUrl zilipata match isiyo sahihi kwenye HTML.
289
+ let type = '';
290
+ if (/\.mpd(\?|$)/i.test(streamUrl)) type = 'DASH';
291
+ else if (/\.m3u8(\?|$)/i.test(streamUrl)) type = 'HLS';
292
+ else if (/\.mp4(\?|$)/i.test(streamUrl)) type = 'MP4';
293
+ else type = mpdUrl ? 'DASH' : (hlsUrl ? 'HLS' : (mp4Url ? 'MP4' : ''));
294
+
295
  const drm = clearKey ? 'CLEARKEY' : (licenseUrl ? 'WIDEVINE' : 'NONE');
296
 
297
  return { name, stream_url: streamUrl, type, drm, clearkey: clearKey, license_url: licenseUrl };