mirror of
https://github.com/sussy-code/providers.git
synced 2026-08-11 17:41:34 +00:00
fix xprime
This commit is contained in:
parent
fc29bf678e
commit
c8c28655b1
1 changed files with 22 additions and 37 deletions
|
|
@ -139,14 +139,20 @@ export const xprimeStreamboxEmbed = makeEmbed({
|
|||
rank: 243,
|
||||
async scrape(ctx): Promise<EmbedOutput> {
|
||||
const query = JSON.parse(ctx.url);
|
||||
let url = showboxBaseUrl;
|
||||
|
||||
let url = `${showboxBaseUrl}?name=${query.title}&year=${query.releaseYear}&fallback_year=${query.releaseYear}`;
|
||||
|
||||
if (query.type === 'show') {
|
||||
url += `?id=${query.tmdbId}&season=${query.season}&episode=${query.episode}`;
|
||||
} else {
|
||||
url += `?id=${query.tmdbId}`;
|
||||
url += `&season=${query.season}&episode=${query.episode}`;
|
||||
}
|
||||
|
||||
// Old handling in case
|
||||
// if (query.type === 'show') {
|
||||
// url += `?id=${query.tmdbId}&season=${query.season}&episode=${query.episode}`;
|
||||
// } else {
|
||||
// url += `?id=${query.tmdbId}`;
|
||||
// }
|
||||
|
||||
const data = await ctx.fetcher(url);
|
||||
|
||||
if (!data) throw new NotFoundError('No response received');
|
||||
|
|
@ -161,37 +167,22 @@ export const xprimeStreamboxEmbed = makeEmbed({
|
|||
type: 'srt',
|
||||
})) || [];
|
||||
|
||||
const qualityMap: Record<string, { type: string; url: string }> = {};
|
||||
|
||||
Object.entries(data.streams).forEach(([key, value]) => {
|
||||
const normalizedKey = key.toLowerCase().replace('p', '');
|
||||
qualityMap[normalizedKey] = {
|
||||
type: 'mp4',
|
||||
url: value as string,
|
||||
};
|
||||
});
|
||||
|
||||
return {
|
||||
stream: [
|
||||
{
|
||||
id: 'primary',
|
||||
captions,
|
||||
qualities: {
|
||||
...(data.streams['1080p'] && {
|
||||
1080: {
|
||||
type: 'mp4',
|
||||
url: data.streams['1080p'],
|
||||
},
|
||||
}),
|
||||
...(data.streams['720p'] && {
|
||||
720: {
|
||||
type: 'mp4',
|
||||
url: data.streams['720p'],
|
||||
},
|
||||
}),
|
||||
...(data.streams['480p'] && {
|
||||
480: {
|
||||
type: 'mp4',
|
||||
url: data.streams['480p'],
|
||||
},
|
||||
}),
|
||||
...(data.streams['360p'] && {
|
||||
360: {
|
||||
type: 'mp4',
|
||||
url: data.streams['360p'],
|
||||
},
|
||||
}),
|
||||
},
|
||||
qualities: qualityMap,
|
||||
type: 'file',
|
||||
flags: [flags.CORS_ALLOWED],
|
||||
},
|
||||
|
|
@ -240,13 +231,7 @@ export const xprimePrimenetEmbed = makeEmbed({
|
|||
rank: 242,
|
||||
async scrape(ctx): Promise<EmbedOutput> {
|
||||
const query = JSON.parse(ctx.url);
|
||||
// let url = `${primenetBaseUrl}?id=${query.tmdbId}`;
|
||||
|
||||
// if (query.type === 'show') {
|
||||
// url += `&season=${query.season}&episode=${query.episode}`;
|
||||
// }
|
||||
|
||||
let url = `${primenetBaseUrl}?name=${query.title}&year=${query.releaseYear}&fallback_year=${query.releaseYear}`;
|
||||
let url = `${primenetBaseUrl}?id=${query.tmdbId}`;
|
||||
|
||||
if (query.type === 'show') {
|
||||
url += `&season=${query.season}&episode=${query.episode}`;
|
||||
|
|
|
|||
Loading…
Reference in a new issue