Merge branch 'dev' into provider-tests

This commit is contained in:
William Oldham
2024-01-20 16:49:13 +00:00
committed by GitHub
6 changed files with 39 additions and 6 deletions

View File

@@ -5,6 +5,10 @@ export const flags = {
// the stream is locked on IP, so only works if // the stream is locked on IP, so only works if
// request maker is same as player (not compatible with proxies) // request maker is same as player (not compatible with proxies)
IP_LOCKED: 'ip-locked', IP_LOCKED: 'ip-locked',
// The source/embed is blocking cloudflare ip's
// This flag is not compatible with a proxy hosted on cloudflare
CF_BLOCKED: 'cf-blocked',
} as const; } as const;
export type Flags = (typeof flags)[keyof typeof flags]; export type Flags = (typeof flags)[keyof typeof flags];

View File

@@ -4,6 +4,9 @@ import { flags } from '@/entrypoint/utils/targets';
import { makeEmbed } from '@/providers/base'; import { makeEmbed } from '@/providers/base';
import { Caption, getCaptionTypeFromUrl, labelToLanguageCode } from '@/providers/captions'; import { Caption, getCaptionTypeFromUrl, labelToLanguageCode } from '@/providers/captions';
const origin = 'https://rabbitstream.net';
const referer = 'https://rabbitstream.net/';
const { AES, enc } = crypto; const { AES, enc } = crypto;
interface StreamRes { interface StreamRes {
@@ -126,6 +129,10 @@ export const upcloudScraper = makeEmbed({
playlist: sources.file, playlist: sources.file,
flags: [flags.CORS_ALLOWED], flags: [flags.CORS_ALLOWED],
captions, captions,
preferredHeaders: {
Referer: referer,
Origin: origin,
},
}, },
], ],
}; };

View File

@@ -3,6 +3,7 @@ import { decodeData } from '@/providers/sources/vidsrcto/common';
import { EmbedScrapeContext } from '@/utils/context'; import { EmbedScrapeContext } from '@/utils/context';
export const vidplayBase = 'https://vidplay.site'; export const vidplayBase = 'https://vidplay.site';
export const referer = 'https://vidplay.online/';
// This file is based on https://github.com/Ciarands/vidsrc-to-resolver/blob/dffa45e726a4b944cb9af0c9e7630476c93c0213/vidsrc.py#L16 // This file is based on https://github.com/Ciarands/vidsrc-to-resolver/blob/dffa45e726a4b944cb9af0c9e7630476c93c0213/vidsrc.py#L16
// Full credits to @Ciarands! // Full credits to @Ciarands!

View File

@@ -1,7 +1,7 @@
import { makeEmbed } from '@/providers/base'; import { makeEmbed } from '@/providers/base';
import { Caption, getCaptionTypeFromUrl, labelToLanguageCode } from '@/providers/captions'; import { Caption, getCaptionTypeFromUrl, labelToLanguageCode } from '@/providers/captions';
import { getFileUrl } from './common'; import { getFileUrl, referer } from './common';
import { SubtitleResult, VidplaySourceResponse } from './types'; import { SubtitleResult, VidplaySourceResponse } from './types';
export const vidplayScraper = makeEmbed({ export const vidplayScraper = makeEmbed({
@@ -46,6 +46,10 @@ export const vidplayScraper = makeEmbed({
playlist: source, playlist: source,
flags: [], flags: [],
captions, captions,
preferredHeaders: {
Referer: referer,
Origin: referer,
},
}, },
], ],
}; };

View File

@@ -4,6 +4,9 @@ import { NotFoundError } from '@/utils/errors';
const remotestreamBase = atob('aHR0cHM6Ly9mc2IuOG1ldDNkdGpmcmNxY2hjb25xcGtsd3hzeGIyb2N1bWMuc3RyZWFt'); const remotestreamBase = atob('aHR0cHM6Ly9mc2IuOG1ldDNkdGpmcmNxY2hjb25xcGtsd3hzeGIyb2N1bWMuc3RyZWFt');
const origin = 'https://remotestre.am';
const referer = 'https://remotestre.am/';
export const remotestreamScraper = makeSourcerer({ export const remotestreamScraper = makeSourcerer({
id: 'remotestream', id: 'remotestream',
name: 'Remote Stream', name: 'Remote Stream',
@@ -16,9 +19,12 @@ export const remotestreamScraper = makeSourcerer({
const playlistLink = `${remotestreamBase}/Shows/${ctx.media.tmdbId}/${seasonNumber}/${episodeNumber}/${episodeNumber}.m3u8`; const playlistLink = `${remotestreamBase}/Shows/${ctx.media.tmdbId}/${seasonNumber}/${episodeNumber}/${episodeNumber}.m3u8`;
ctx.progress(30); ctx.progress(30);
const streamRes = await ctx.fetcher.full(playlistLink, { const streamRes = await ctx.proxiedFetcher.full(playlistLink, {
method: 'HEAD', method: 'GET',
readHeaders: ['content-type'], readHeaders: ['content-type'],
headers: {
Referer: referer,
},
}); });
if (!streamRes.headers.get('content-type')?.toLowerCase().includes('application/x-mpegurl')) if (!streamRes.headers.get('content-type')?.toLowerCase().includes('application/x-mpegurl'))
throw new NotFoundError('No watchable item found'); throw new NotFoundError('No watchable item found');
@@ -33,6 +39,10 @@ export const remotestreamScraper = makeSourcerer({
playlist: playlistLink, playlist: playlistLink,
type: 'hls', type: 'hls',
flags: [flags.CORS_ALLOWED], flags: [flags.CORS_ALLOWED],
preferredHeaders: {
Referer: referer,
Origin: origin,
},
}, },
], ],
}; };
@@ -41,9 +51,12 @@ export const remotestreamScraper = makeSourcerer({
const playlistLink = `${remotestreamBase}/Movies/${ctx.media.tmdbId}/${ctx.media.tmdbId}.m3u8`; const playlistLink = `${remotestreamBase}/Movies/${ctx.media.tmdbId}/${ctx.media.tmdbId}.m3u8`;
ctx.progress(30); ctx.progress(30);
const streamRes = await ctx.fetcher.full(playlistLink, { const streamRes = await ctx.proxiedFetcher.full(playlistLink, {
method: 'HEAD', method: 'GET',
readHeaders: ['content-type'], readHeaders: ['content-type'],
headers: {
Referer: referer,
},
}); });
if (!streamRes.headers.get('content-type')?.toLowerCase().includes('application/x-mpegurl')) if (!streamRes.headers.get('content-type')?.toLowerCase().includes('application/x-mpegurl'))
throw new NotFoundError('No watchable item found'); throw new NotFoundError('No watchable item found');
@@ -58,6 +71,10 @@ export const remotestreamScraper = makeSourcerer({
playlist: playlistLink, playlist: playlistLink,
type: 'hls', type: 'hls',
flags: [flags.CORS_ALLOWED], flags: [flags.CORS_ALLOWED],
preferredHeaders: {
Referer: referer,
Origin: origin,
},
}, },
], ],
}; };

View File

@@ -42,7 +42,7 @@ export const showboxScraper = makeSourcerer({
id: 'showbox', id: 'showbox',
name: 'Showbox', name: 'Showbox',
rank: 300, rank: 300,
flags: [flags.CORS_ALLOWED], flags: [flags.CORS_ALLOWED, flags.CF_BLOCKED],
scrapeShow: comboScraper, scrapeShow: comboScraper,
scrapeMovie: comboScraper, scrapeMovie: comboScraper,
}); });