api/match-action: rename isM3U8 to isHLS and u to url

This commit is contained in:
wukko 2024-10-28 15:14:36 +06:00
parent 7c516c0468
commit a46e04358a
No known key found for this signature in database
GPG key ID: 3E30B3F26C7B4AA2
7 changed files with 16 additions and 16 deletions

View file

@ -9,7 +9,7 @@ export default function({ r, host, audioFormat, isAudioOnly, isAudioMuted, disab
let action,
responseType = "tunnel",
defaultParams = {
u: r.urls,
url: r.urls,
headers: r.headers,
service: host,
filename: r.filenameAttributes ?
@ -24,7 +24,7 @@ export default function({ r, host, audioFormat, isAudioOnly, isAudioMuted, disab
else if (r.isGif && twitterGif) action = "gif";
else if (isAudioOnly) action = "audio";
else if (isAudioMuted) action = "muteVideo";
else if (r.isM3U8) action = "m3u8";
else if (r.isHLS) action = "hls";
else action = "video";
if (action === "picker" || action === "audio") {
@ -54,7 +54,7 @@ export default function({ r, host, audioFormat, isAudioOnly, isAudioMuted, disab
params = { type: "gif" };
break;
case "m3u8":
case "hls":
params = {
type: Array.isArray(r.urls) ? "merge" : "remux"
}
@ -62,12 +62,12 @@ export default function({ r, host, audioFormat, isAudioOnly, isAudioMuted, disab
case "muteVideo":
let muteType = "mute";
if (Array.isArray(r.urls) && !r.isM3U8) {
if (Array.isArray(r.urls) && !r.isHLS) {
muteType = "proxy";
}
params = {
type: muteType,
u: Array.isArray(r.urls) ? r.urls[0] : r.urls
url: Array.isArray(r.urls) ? r.urls[0] : r.urls
}
if (host === "reddit" && r.typeId === "redirect") {
responseType = "redirect";
@ -92,10 +92,10 @@ export default function({ r, host, audioFormat, isAudioOnly, isAudioMuted, disab
}
params = {
picker: r.picker,
u: createStream({
url: createStream({
service: "tiktok",
type: audioStreamType,
u: r.urls,
url: r.urls,
headers: r.headers,
filename: r.audioFilename,
isAudioOnly: true,
@ -184,14 +184,14 @@ export default function({ r, host, audioFormat, isAudioOnly, isAudioMuted, disab
}
}
if (r.isM3U8 || host === "vimeo") {
if (r.isHLS || host === "vimeo") {
copy = false;
processType = "audio";
}
params = {
type: processType,
u: Array.isArray(r.urls) ? r.urls[1] : r.urls,
url: Array.isArray(r.urls) ? r.urls[1] : r.urls,
audioBitrate,
audioCopy: copy,

View file

@ -37,7 +37,7 @@ export function createResponse(responseType, responseData) {
case "redirect":
response = {
url: responseData?.u,
url: responseData?.url,
filename: responseData?.filename
}
break;
@ -52,7 +52,7 @@ export function createResponse(responseType, responseData) {
case "picker":
response = {
picker: responseData?.picker,
audio: responseData?.u,
audio: responseData?.url,
audioFilename: responseData?.filename
}
break;

View file

@ -26,7 +26,7 @@ const extractVideo = async ({ media, filename }) => {
urls: videoURL,
filename: `${filename}.mp4`,
audioFilename: `${filename}_audio`,
isM3U8: true,
isHLS: true,
}
}

View file

@ -92,7 +92,7 @@ export default async function({ id }) {
return {
urls: bestQuality.uri,
isM3U8: true,
isHLS: true,
filenameAttributes: {
service: 'dailymotion',
id: media.xid,

View file

@ -65,7 +65,7 @@ export default async function(obj) {
return {
urls: matchingQuality.uri,
isM3U8: true,
isHLS: true,
filenameAttributes: {
service: "rutube",
id: obj.id,

View file

@ -122,7 +122,7 @@ const getHLS = async (configURL, obj) => {
return {
urls,
isM3U8: true,
isHLS: true,
filenameAttributes: {
resolution: `${bestQuality.resolution.width}x${bestQuality.resolution.height}`,
qualityLabel: `${resolutionMatch[bestQuality.resolution.width]}p`,

View file

@ -34,7 +34,7 @@ export function createStream(obj) {
streamData = {
exp: exp,
type: obj.type,
urls: obj.u,
urls: obj.url,
service: obj.service,
filename: obj.filename,