add vidcloud to flixhq and zoechip

This commit is contained in:
Jorrin 2024-01-15 19:27:36 +01:00
parent b3212bd327
commit 8819648023
4 changed files with 62 additions and 17 deletions

View File

@ -20,6 +20,7 @@ import { zoechipScraper } from '@/providers/sources/zoechip';
import { fileMoonScraper } from './embeds/filemoon';
import { smashyStreamDScraper } from './embeds/smashystream/dued';
import { smashyStreamFScraper } from './embeds/smashystream/video1';
import { vidCloudScraper } from './embeds/vidcloud';
import { vidplayScraper } from './embeds/vidplay';
import { smashyStreamScraper } from './sources/smashystream';
import { vidSrcToScraper } from './sources/vidsrcto';
@ -44,6 +45,7 @@ export function gatherAllEmbeds(): Array<Embed> {
// all embeds are gathered here
return [
upcloudScraper,
vidCloudScraper,
mp4uploadScraper,
streamsbScraper,
upstreamScraper,

View File

@ -0,0 +1,19 @@
import { makeEmbed } from '@/providers/base';
import { upcloudScraper } from './upcloud';
export const vidCloudScraper = makeEmbed({
id: 'vidcloud',
name: 'VidCloud',
rank: 201,
async scrape(ctx) {
// Both vidcloud and upcloud have the same embed domain (rabbitstream.net)
const result = await upcloudScraper.scrape(ctx);
return {
stream: result.stream.map((s) => ({
...s,
flags: [],
})),
};
},
});

View File

@ -1,6 +1,7 @@
import { flags } from '@/entrypoint/utils/targets';
import { makeSourcerer } from '@/providers/base';
import { SourcererEmbed, makeSourcerer } from '@/providers/base';
import { upcloudScraper } from '@/providers/embeds/upcloud';
import { vidCloudScraper } from '@/providers/embeds/vidcloud';
import { getFlixhqMovieSources, getFlixhqShowSources, getFlixhqSourceDetails } from '@/providers/sources/flixhq/scrape';
import { getFlixhqId } from '@/providers/sources/flixhq/search';
import { NotFoundError } from '@/utils/errors';
@ -15,16 +16,25 @@ export const flixhqScraper = makeSourcerer({
if (!id) throw new NotFoundError('no search results match');
const sources = await getFlixhqMovieSources(ctx, ctx.media, id);
const upcloudStream = sources.find((v) => v.embed.toLowerCase() === 'upcloud');
if (!upcloudStream) throw new NotFoundError('upcloud stream not found for flixhq');
const embeds: SourcererEmbed[] = [];
for (const source of sources) {
if (source.embed.toLowerCase() === 'upcloud') {
embeds.push({
embedId: upcloudScraper.id,
url: await getFlixhqSourceDetails(ctx, source.episodeId),
});
} else if (source.embed.toLowerCase() === 'vidcloud') {
embeds.push({
embedId: vidCloudScraper.id,
url: await getFlixhqSourceDetails(ctx, source.episodeId),
});
}
}
return {
embeds: [
{
embedId: upcloudScraper.id,
url: await getFlixhqSourceDetails(ctx, upcloudStream.episodeId),
},
],
embeds,
};
},
async scrapeShow(ctx) {
@ -32,16 +42,24 @@ export const flixhqScraper = makeSourcerer({
if (!id) throw new NotFoundError('no search results match');
const sources = await getFlixhqShowSources(ctx, ctx.media, id);
const upcloudStream = sources.find((v) => v.embed.toLowerCase() === 'server upcloud');
if (!upcloudStream) throw new NotFoundError('upcloud stream not found for flixhq');
const embeds: SourcererEmbed[] = [];
for (const source of sources) {
if (source.embed.toLowerCase() === 'server upcloud') {
embeds.push({
embedId: upcloudScraper.id,
url: await getFlixhqSourceDetails(ctx, source.episodeId),
});
} else if (source.embed.toLowerCase() === 'server vidcloud') {
embeds.push({
embedId: vidCloudScraper.id,
url: await getFlixhqSourceDetails(ctx, source.episodeId),
});
}
}
return {
embeds: [
{
embedId: upcloudScraper.id,
url: await getFlixhqSourceDetails(ctx, upcloudStream.episodeId),
},
],
embeds,
};
},
});

View File

@ -1,6 +1,7 @@
import { mixdropScraper } from '@/providers/embeds/mixdrop';
import { upcloudScraper } from '@/providers/embeds/upcloud';
import { upstreamScraper } from '@/providers/embeds/upstream';
import { vidCloudScraper } from '@/providers/embeds/vidcloud';
import { getZoeChipSourceURL, getZoeChipSources } from '@/providers/sources/zoechip/scrape';
import { MovieScrapeContext, ShowScrapeContext } from '@/utils/context';
@ -55,6 +56,11 @@ export async function createZoeChipStreamData(ctx: MovieScrapeContext | ShowScra
for (const source of sources) {
const formatted = await formatSource(ctx, source);
if (formatted) {
// Zoechip does not return titles for their sources, so we can not check if a source is upcloud or vidcloud because the domain is the same.
const upCloudAlreadyExists = embeds.find((e) => e.embedId === upcloudScraper.id);
if (formatted.embedId === upcloudScraper.id && upCloudAlreadyExists) {
formatted.embedId = vidCloudScraper.id;
}
embeds.push(formatted);
}
}