mirror of
https://github.com/p-stream/providers.git
synced 2026-01-11 20:10:33 +00:00
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.
36 lines
1 KiB
TypeScript
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,
|
|
},
|
|
],
|
|
};
|
|
},
|
|
});
|