mirror of
https://github.com/bytedream/stream-bypass.git
synced 2025-05-09 20:25:14 +02:00
Format
This commit is contained in:
parent
8d575241fe
commit
8a13dea681
@ -1,5 +1,5 @@
|
|||||||
import {getMatch, type Match, MatchMediaType} from '~/lib/match';
|
import { getMatch, type Match, MatchMediaType } from '~/lib/match';
|
||||||
import {Other, Redirect} from '~/lib/settings';
|
import { Other, Redirect } from '~/lib/settings';
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
let match: Match | null;
|
let match: Match | null;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import {matches, MatchMediaType} from '~/lib/match';
|
import { matches, MatchMediaType } from '~/lib/match';
|
||||||
import Hls from 'hls.js';
|
import Hls from 'hls.js';
|
||||||
import {UrlReferer} from '~/lib/settings';
|
import { UrlReferer } from '~/lib/settings';
|
||||||
|
|
||||||
async function playNative(url: string, domain: string, videoElem: HTMLVideoElement) {
|
async function playNative(url: string, domain: string, videoElem: HTMLVideoElement) {
|
||||||
await UrlReferer.set(new URL(url).hostname, domain);
|
await UrlReferer.set(new URL(url).hostname, domain);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { unpack } from './util/userspace';
|
import { unpack } from './util/userspace';
|
||||||
import { Hosters, Redirect, TmpHost } from './settings';
|
import { Hosters, Redirect, TmpHost } from './settings';
|
||||||
import {lastPathSegment} from "~/lib/util/extract";
|
import { lastPathSegment } from '~/lib/util/extract';
|
||||||
|
|
||||||
export interface Match {
|
export interface Match {
|
||||||
name: string;
|
name: string;
|
||||||
@ -10,12 +10,16 @@ export interface Match {
|
|||||||
regex: RegExp[];
|
regex: RegExp[];
|
||||||
notice?: string;
|
notice?: string;
|
||||||
|
|
||||||
match(match: RegExpMatchArray): Promise<string | {[MatchMediaType.Hls]: string} | {[MatchMediaType.Native]: string} | null>;
|
match(
|
||||||
|
match: RegExpMatchArray
|
||||||
|
): Promise<
|
||||||
|
string | { [MatchMediaType.Hls]: string } | { [MatchMediaType.Native]: string } | null
|
||||||
|
>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum MatchMediaType {
|
export enum MatchMediaType {
|
||||||
Hls = 'hls',
|
Hls = 'hls',
|
||||||
Native = 'native',
|
Native = 'native'
|
||||||
}
|
}
|
||||||
|
|
||||||
export const Doodstream: Match = {
|
export const Doodstream: Match = {
|
||||||
@ -134,7 +138,7 @@ export const LoadX: Match = {
|
|||||||
const videoSource: string = responseJson['videoSource'];
|
const videoSource: string = responseJson['videoSource'];
|
||||||
|
|
||||||
// extension of extracted url is '.txt', so we have to manually specify that it's a hls
|
// extension of extracted url is '.txt', so we have to manually specify that it's a hls
|
||||||
return {[MatchMediaType.Hls]: videoSource.replace('\\/', '/')};
|
return { [MatchMediaType.Hls]: videoSource.replace('\\/', '/') };
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
export function lastPathSegment(path: string): string {
|
export function lastPathSegment(path: string): string {
|
||||||
while (path.endsWith('/')) {
|
while (path.endsWith('/')) {
|
||||||
path = path.slice(0, -1);
|
path = path.slice(0, -1);
|
||||||
}
|
}
|
||||||
return path.substring(path.lastIndexOf('/') + 1);
|
return path.substring(path.lastIndexOf('/') + 1);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user