pstreams-providers/src/providers/archive/embeds/filemoon/mp4.ts
Pas e6b1a7ada8 Bring public providers more inline with private providers
Adds a few more sources and brings some features and functions over. Of course many sources and embeds have been left our so they don't get patched. But this should make some development eaiser.
2025-12-09 23:30:18 -07:00

36 lines
1 KiB
TypeScript

import { flags } from '@/entrypoint/utils/targets';
import { makeEmbed } from '@/providers/base';
import { NotFoundError } from '@/utils/errors';
import { fileMoonScraper } from './index';
export const fileMoonMp4Scraper = makeEmbed({
id: 'filemoon-mp4',
name: 'Filemoon MP4',
rank: 406,
flags: [flags.IP_LOCKED],
async scrape(ctx) {
const result = await fileMoonScraper.scrape(ctx);
if (!result.stream || result.stream.length === 0) throw new NotFoundError('Failed to find result');
if (result.stream[0].type !== 'hls') throw new NotFoundError('Failed to find hls stream');
const mp4Url = result.stream[0].playlist.replace(/\/hls2\//, '/download/').replace(/\.m3u8.*/, '.mp4');
return {
stream: [
{
id: 'primary',
type: 'file',
qualities: {
unknown: {
type: 'mp4',
url: mp4Url,
},
},
flags: [flags.IP_LOCKED],
captions: result.stream[0].captions,
},
],
};
},
});