Use qualities returned by the api in mp4hydra
Some checks failed
Testing / Testing (push) Has been cancelled

This commit is contained in:
TPN 2025-01-10 15:33:56 +00:00
parent e2172508e4
commit c14fdc5fba
2 changed files with 7 additions and 3 deletions

View file

@ -1,5 +1,6 @@
import { flags } from '@/entrypoint/utils/targets';
import { makeEmbed } from '@/providers/base';
import { getValidQualityFromString } from '@/utils/quality';
const providers = [
{
@ -21,13 +22,14 @@ function embed(provider: { id: string; name: string; rank: number; disabled?: bo
disabled: provider.disabled,
rank: provider.rank,
async scrape(ctx) {
const [url, quality] = ctx.url.split('|');
return {
stream: [
{
id: 'primary',
type: 'file',
qualities: {
unknown: { url: ctx.url, type: 'mp4' },
[getValidQualityFromString(quality || '')]: { url, type: 'mp4' },
},
flags: [flags.CORS_ALLOWED],
captions: [],

View file

@ -41,7 +41,7 @@ async function comboScraper(ctx: ShowScrapeContext | MovieScrapeContext): Promis
ctx.progress(60);
const data: { playlist: { src: string }[]; servers: { [key: string]: string; auto: string } } =
const data: { playlist: { src: string; label: string }[]; servers: { [key: string]: string; auto: string } } =
await ctx.proxiedFetcher('/info2?v=8', {
method: 'POST',
body: new URLSearchParams({ z: JSON.stringify([{ s, t: 'movie' }]) }),
@ -56,7 +56,9 @@ async function comboScraper(ctx: ShowScrapeContext | MovieScrapeContext): Promis
[
data.servers[data.servers.auto],
...Object.values(data.servers).filter((x) => x !== data.servers[data.servers.auto] && x !== data.servers.auto),
].forEach((server, _) => embeds.push({ embedId: `mp4hydra-${_ + 1}`, url: server + data.playlist[0].src }));
].forEach((server, _) =>
embeds.push({ embedId: `mp4hydra-${_ + 1}`, url: `${server}${data.playlist[0].src}|${data.playlist[0].label}` }),
);
ctx.progress(90);