add server mirror embed

This commit is contained in:
Pas 2025-11-23 16:03:23 -07:00
parent 49489ca9a5
commit 2f3a73c3d2
2 changed files with 38 additions and 0 deletions

View file

@ -2,6 +2,7 @@ import { Embed, Sourcerer } from '@/providers/base';
import { doodScraper } from '@/providers/embeds/dood';
import { filemoonScraper } from '@/providers/embeds/filemoon';
import { mixdropScraper } from '@/providers/embeds/mixdrop';
import { serverMirrorEmbed } from '@/providers/embeds/server-mirrors';
import { turbovidScraper } from '@/providers/embeds/turbovid';
import { upcloudScraper } from '@/providers/embeds/upcloud';
import { autoembedScraper } from '@/providers/sources/autoembed';
@ -150,6 +151,7 @@ export function gatherAllSources(): Array<Sourcerer> {
export function gatherAllEmbeds(): Array<Embed> {
// all embeds are gathered here
return [
serverMirrorEmbed,
upcloudScraper,
vidCloudScraper,
mixdropScraper,

View file

@ -0,0 +1,36 @@
import { makeEmbed } from '@/providers/base';
export const serverMirrorEmbed = makeEmbed({
id: 'mirror',
name: 'Mirror',
rank: 1,
async scrape(ctx) {
const context = JSON.parse(ctx.url);
if (context.type === 'hls') {
return {
stream: [
{
id: 'primary',
type: 'hls',
playlist: context.stream,
headers: context.headers,
flags: context.flags,
captions: context.captions,
},
],
};
}
return {
stream: [
{
id: 'primary',
type: 'file',
qualities: context.qualities,
flags: context.flags,
captions: context.captions,
headers: context.headers,
},
],
};
},
});