mirror of
https://github.com/sussy-code/providers.git
synced 2026-04-21 00:22:07 +00:00
Add vidker embed
This commit is contained in:
parent
5735b4cd87
commit
178e181bba
3 changed files with 66 additions and 1 deletions
|
|
@ -11,6 +11,7 @@ import { streamsbScraper } from '@/providers/embeds/streamsb';
|
||||||
import { turbovidScraper } from '@/providers/embeds/turbovid';
|
import { turbovidScraper } from '@/providers/embeds/turbovid';
|
||||||
import { upcloudScraper } from '@/providers/embeds/upcloud';
|
import { upcloudScraper } from '@/providers/embeds/upcloud';
|
||||||
import { upstreamScraper } from '@/providers/embeds/upstream';
|
import { upstreamScraper } from '@/providers/embeds/upstream';
|
||||||
|
import { vidkerScraper } from '@/providers/embeds/vidker';
|
||||||
import { vidsrcembedScraper } from '@/providers/embeds/vidsrc';
|
import { vidsrcembedScraper } from '@/providers/embeds/vidsrc';
|
||||||
import { vTubeScraper } from '@/providers/embeds/vtube';
|
import { vTubeScraper } from '@/providers/embeds/vtube';
|
||||||
import { astraScraper, novaScraper } from '@/providers/embeds/whvx';
|
import { astraScraper, novaScraper } from '@/providers/embeds/whvx';
|
||||||
|
|
@ -144,5 +145,6 @@ export function gatherAllEmbeds(): Array<Embed> {
|
||||||
turbovidScraper,
|
turbovidScraper,
|
||||||
novaScraper,
|
novaScraper,
|
||||||
astraScraper,
|
astraScraper,
|
||||||
|
vidkerScraper,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
62
src/providers/embeds/vidker.ts
Normal file
62
src/providers/embeds/vidker.ts
Normal file
|
|
@ -0,0 +1,62 @@
|
||||||
|
import { flags } from '@/entrypoint/utils/targets';
|
||||||
|
import { makeEmbed } from '@/providers/base';
|
||||||
|
import { Caption, getCaptionTypeFromUrl, labelToLanguageCode } from '@/providers/captions';
|
||||||
|
import { FileBasedStream } from '@/providers/streams';
|
||||||
|
import { getValidQualityFromString } from '@/utils/quality';
|
||||||
|
|
||||||
|
export const vidkerScraper = makeEmbed({
|
||||||
|
id: 'vidker',
|
||||||
|
name: 'VidKer',
|
||||||
|
rank: 93,
|
||||||
|
async scrape(ctx) {
|
||||||
|
const embed = await ctx.proxiedFetcher<string>(ctx.url);
|
||||||
|
|
||||||
|
const sourcesMatch = embed.match(/sources:\s*(\[.*?\])/)?.[1];
|
||||||
|
const tracksMatch = embed.match(/tracks:\s*(\[[^\]]*\])/)?.[1];
|
||||||
|
if (!sourcesMatch) throw new Error('No sources found');
|
||||||
|
|
||||||
|
const sources: { file: string; label: string }[] = JSON.parse(sourcesMatch.replace(/(\w+):"(\S*?)"/g, '"$1":"$2"'));
|
||||||
|
const tracks: { file: string; label: string }[] = JSON.parse(
|
||||||
|
tracksMatch?.replace(/\s+/g, '').replace(/(\w+):"(\S*?)"/g, '"$1":"$2"') ?? '[]',
|
||||||
|
);
|
||||||
|
|
||||||
|
const qualities = sources.reduce(
|
||||||
|
(acc, source) => {
|
||||||
|
const validQuality = getValidQualityFromString(source.label);
|
||||||
|
acc[validQuality] = {
|
||||||
|
type: 'mp4',
|
||||||
|
url: `${source.file}`,
|
||||||
|
};
|
||||||
|
return acc;
|
||||||
|
},
|
||||||
|
{} as FileBasedStream['qualities'],
|
||||||
|
);
|
||||||
|
|
||||||
|
const captions: Caption[] = [];
|
||||||
|
|
||||||
|
for (const caption of tracks) {
|
||||||
|
const language = labelToLanguageCode(caption.label);
|
||||||
|
const captionType = getCaptionTypeFromUrl(caption.file);
|
||||||
|
if (!language || !captionType) continue;
|
||||||
|
captions.push({
|
||||||
|
id: caption.file,
|
||||||
|
url: caption.file,
|
||||||
|
type: captionType,
|
||||||
|
language,
|
||||||
|
hasCorsRestrictions: false,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
stream: [
|
||||||
|
{
|
||||||
|
id: 'primary',
|
||||||
|
type: 'file',
|
||||||
|
qualities,
|
||||||
|
flags: [flags.CORS_ALLOWED],
|
||||||
|
captions,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
@ -4,6 +4,7 @@
|
||||||
// and i dont feel like doing that now
|
// and i dont feel like doing that now
|
||||||
import { load } from 'cheerio';
|
import { load } from 'cheerio';
|
||||||
|
|
||||||
|
import { flags } from '@/entrypoint/utils/targets';
|
||||||
import { SourcererEmbed, SourcererOutput, makeSourcerer } from '@/providers/base';
|
import { SourcererEmbed, SourcererOutput, makeSourcerer } from '@/providers/base';
|
||||||
import { compareMedia } from '@/utils/compare';
|
import { compareMedia } from '@/utils/compare';
|
||||||
import { MovieScrapeContext, ShowScrapeContext } from '@/utils/context';
|
import { MovieScrapeContext, ShowScrapeContext } from '@/utils/context';
|
||||||
|
|
@ -89,6 +90,6 @@ export const moviplusScraper = makeSourcerer({
|
||||||
id: 'moviplus',
|
id: 'moviplus',
|
||||||
name: 'MoviPlus',
|
name: 'MoviPlus',
|
||||||
rank: 92,
|
rank: 92,
|
||||||
flags: [],
|
flags: [flags.CORS_ALLOWED],
|
||||||
scrapeMovie: comboScraper,
|
scrapeMovie: comboScraper,
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue