Use enum to specify media type

This commit is contained in:
2025-04-03 23:56:18 +02:00
parent f6fcfd354a
commit 50f400b8b9
3 changed files with 23 additions and 19 deletions
+7 -2
View File
@@ -10,7 +10,12 @@ export interface Match {
regex: RegExp[];
notice?: string;
match(match: RegExpMatchArray): Promise<string | { hls: string } | { native: string } | null>;
match(match: RegExpMatchArray): Promise<string | {[MatchMediaType.Hls]: string} | {[MatchMediaType.Native]: string} | null>;
}
export enum MatchMediaType {
Hls = 'hls',
Native = 'native',
}
export const Doodstream: Match = {
@@ -129,7 +134,7 @@ export const LoadX: Match = {
const videoSource: string = responseJson['videoSource'];
// extension of extracted url is '.txt', so we have to manually specify that it's a hls
return {hls: videoSource.replace('\\/', '/')};
return {[MatchMediaType.Hls]: videoSource.replace('\\/', '/')};
}
};