Add modules by emp0ry
This commit is contained in:
@@ -314,11 +314,20 @@ async function extractStreamUrl(href) {
|
||||
const qualities = _safeJsonParse(qualitiesJson, {});
|
||||
let bestUrl = "";
|
||||
let bestQ = 0;
|
||||
let url1080 = null;
|
||||
let url720 = null;
|
||||
let url480 = null;
|
||||
|
||||
for (const q in qualities) {
|
||||
const src = qualities?.[q]?.src;
|
||||
const srcRaw = qualities?.[q]?.src;
|
||||
const src = srcRaw ? (String(srcRaw).startsWith("//") ? "https:" + String(srcRaw) : String(srcRaw)) : "";
|
||||
if (!src) continue;
|
||||
const n = parseInt(String(q).replace(/[^\d]/g, ""), 10) || 0;
|
||||
|
||||
if (n >= 1080 && !url1080) url1080 = src;
|
||||
if (n === 720 && !url720) url720 = src;
|
||||
if (n === 480 && !url480) url480 = src;
|
||||
|
||||
if (n > bestQ) {
|
||||
bestQ = n;
|
||||
bestUrl = src;
|
||||
@@ -327,11 +336,19 @@ async function extractStreamUrl(href) {
|
||||
|
||||
if (!bestUrl) continue;
|
||||
|
||||
const finalUrl = bestUrl.startsWith("//") ? "https:" + bestUrl : bestUrl;
|
||||
const finalUrl = bestUrl;
|
||||
|
||||
// Fallback quality mapping for sources with uncommon labels.
|
||||
if (!url1080 && bestQ >= 1080) url1080 = finalUrl;
|
||||
if (!url720 && bestQ >= 720 && bestQ < 1080) url720 = finalUrl;
|
||||
if (!url480 && bestQ >= 480 && bestQ < 720) url480 = finalUrl;
|
||||
|
||||
streams.push({
|
||||
title: `${opt.dubbing}${bestQ ? ` (${bestQ}p)` : ""} (Kodik)`,
|
||||
title: `${opt.dubbing} (Kodik)`,
|
||||
streamUrl: finalUrl,
|
||||
url1080,
|
||||
url720,
|
||||
url480,
|
||||
headers: {
|
||||
"User-Agent": _ua(),
|
||||
"Referer": IMAGE_REFERER
|
||||
|
||||
Reference in New Issue
Block a user