Merge branch 'movie-web:dev' into dev

This commit is contained in:
infvortx 2024-04-07 10:53:44 +03:00 committed by GitHub
commit a58ea29ae5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
20 changed files with 280 additions and 146 deletions

View File

@ -2,6 +2,12 @@
title: 'Changelog'
---
# Version 2.2.9
- Fixed VidSrcTo (both Vidplay and Filemoon embeds)
- Added dropload, filelions and vtube embeds to Primewire
- Fixed and enabled Smashystream
- Improved RidoMovies search results
# Version 2.2.8
- Fix package exports for CJS and ESM
- Fixed Mixdrop embed

View File

@ -7370,7 +7370,7 @@ packages:
fast-glob: 3.3.2
js-yaml: 4.1.0
supports-color: 9.4.0
undici: 5.28.3
undici: 5.28.4
yargs-parser: 21.1.1
dev: true
@ -9117,8 +9117,8 @@ packages:
resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==}
dev: true
/undici@5.28.3:
resolution: {integrity: sha512-3ItfzbrhDlINjaP0duwnNsKpDQk3acHI3gVJ1z4fmwMK31k5G9OVIAMLSIaP6w4FaGkaAkN6zaQO9LUvZ1t7VA==}
/undici@5.28.4:
resolution: {integrity: sha512-72RFADWFqKmUb2hmmvNODKL3p9hcB6Gt2DOQMis1SEBaV6a4MH8soBvzg+95CYhCKPFedut2JY9bMfrDl9D23g==}
engines: {node: '>=14.0'}
dependencies:
'@fastify/busboy': 2.1.1

View File

@ -1,6 +1,6 @@
{
"name": "@movie-web/providers",
"version": "2.2.8",
"version": "2.2.9",
"description": "Package that contains all the providers of movie-web",
"type": "module",
"main": "./lib/index.js",

View File

@ -1,7 +1,9 @@
import { Embed, Sourcerer } from '@/providers/base';
import { doodScraper } from '@/providers/embeds/dood';
import { droploadScraper } from '@/providers/embeds/dropload';
import { febboxHlsScraper } from '@/providers/embeds/febbox/hls';
import { febboxMp4Scraper } from '@/providers/embeds/febbox/mp4';
import { filelionsScraper } from '@/providers/embeds/filelions';
import { mixdropScraper } from '@/providers/embeds/mixdrop';
import { mp4uploadScraper } from '@/providers/embeds/mp4upload';
import { streambucketScraper } from '@/providers/embeds/streambucket';
@ -9,6 +11,7 @@ import { streamsbScraper } from '@/providers/embeds/streamsb';
import { upcloudScraper } from '@/providers/embeds/upcloud';
import { upstreamScraper } from '@/providers/embeds/upstream';
import { vidsrcembedScraper } from '@/providers/embeds/vidsrc';
import { vTubeScraper } from '@/providers/embeds/vtube';
import { flixhqScraper } from '@/providers/sources/flixhq/index';
import { goMoviesScraper } from '@/providers/sources/gomovies/index';
import { insertunitScraper } from '@/providers/sources/insertunit';
@ -22,7 +25,7 @@ import { zoechipScraper } from '@/providers/sources/zoechip';
import { closeLoadScraper } from './embeds/closeload';
import { fileMoonScraper } from './embeds/filemoon';
import { ridooScraper } from './embeds/ridoo';
import { smashyStreamDScraper } from './embeds/smashystream/dued';
import { smashyStreamOScraper } from './embeds/smashystream/opstream';
import { smashyStreamFScraper } from './embeds/smashystream/video1';
import { streamtapeScraper } from './embeds/streamtape';
import { streamvidScraper } from './embeds/streamvid';
@ -74,7 +77,7 @@ export function gatherAllEmbeds(): Array<Embed> {
vidsrcembedScraper,
streambucketScraper,
smashyStreamFScraper,
smashyStreamDScraper,
smashyStreamOScraper,
ridooScraper,
closeLoadScraper,
fileMoonScraper,
@ -84,5 +87,8 @@ export function gatherAllEmbeds(): Array<Embed> {
streamvidScraper,
voeScraper,
streamtapeScraper,
droploadScraper,
filelionsScraper,
vTubeScraper,
];
}

View File

@ -25,6 +25,7 @@ export const doodScraper = makeEmbed({
const dataForLater = doodData.match(/\?token=([^&]+)&expiry=/)?.[1];
const path = doodData.match(/\$\.get\('\/pass_md5([^']+)/)?.[1];
const thumbnailTrack = doodData.match(/thumbnails:\s\{\s*vtt:\s'([^']*)'/);
const doodPage = await ctx.proxiedFetcher<string>(`/pass_md5${path}`, {
headers: {
@ -53,6 +54,14 @@ export const doodScraper = makeEmbed({
headers: {
Referer: baseUrl,
},
...(thumbnailTrack
? {
thumbnailTrack: {
type: 'vtt',
url: `https:${thumbnailTrack[1]}`,
},
}
: {}),
},
],
};

View File

@ -0,0 +1,52 @@
import { unpack } from 'unpacker';
import { flags } from '@/entrypoint/utils/targets';
import { makeEmbed } from '../base';
const evalCodeRegex = /eval\((.*)\)/g;
const fileRegex = /file:"(.*?)"/g;
const tracksRegex = /\{file:"([^"]+)",kind:"thumbnails"\}/g;
export const droploadScraper = makeEmbed({
id: 'dropload',
name: 'Dropload',
rank: 120,
scrape: async (ctx) => {
const mainPageRes = await ctx.proxiedFetcher.full<string>(ctx.url, {
headers: {
referer: ctx.url,
},
});
const mainPageUrl = new URL(mainPageRes.finalUrl);
const mainPage = mainPageRes.body;
const evalCode = mainPage.match(evalCodeRegex);
if (!evalCode) throw new Error('Failed to find eval code');
const unpacked = unpack(evalCode[1]);
const file = fileRegex.exec(unpacked);
const thumbnailTrack = tracksRegex.exec(unpacked);
if (!file?.[1]) throw new Error('Failed to find file');
return {
stream: [
{
id: 'primary',
type: 'hls',
playlist: file[1],
flags: [flags.IP_LOCKED, flags.CORS_ALLOWED],
captions: [],
...(thumbnailTrack
? {
thumbnailTrack: {
type: 'vtt',
url: mainPageUrl.origin + thumbnailTrack[1],
},
}
: {}),
},
],
};
},
});

View File

@ -0,0 +1,47 @@
import { flags } from '@/entrypoint/utils/targets';
import { makeEmbed } from '@/providers/base';
const linkRegex = /file: ?"(http.*?)"/;
// the white space charecters may seem useless, but without them it breaks
const tracksRegex = /\{file:\s"([^"]+)",\skind:\s"thumbnails"\}/g;
export const filelionsScraper = makeEmbed({
id: 'filelions',
name: 'filelions',
rank: 115,
async scrape(ctx) {
const mainPageRes = await ctx.proxiedFetcher.full<string>(ctx.url, {
headers: {
referer: ctx.url,
},
});
const mainPage = mainPageRes.body;
const mainPageUrl = new URL(mainPageRes.finalUrl);
const streamUrl = mainPage.match(linkRegex) ?? [];
const thumbnailTrack = tracksRegex.exec(mainPage);
const playlist = streamUrl[1];
if (!playlist) throw new Error('Stream url not found');
return {
stream: [
{
id: 'primary',
type: 'hls',
playlist,
flags: [flags.IP_LOCKED, flags.CORS_ALLOWED],
captions: [],
...(thumbnailTrack
? {
thumbnailTrack: {
type: 'vtt',
url: mainPageUrl.origin + thumbnailTrack[1],
},
}
: {}),
},
],
};
},
});

View File

@ -1,8 +1,6 @@
import { load } from 'cheerio';
import { unpack } from 'unpacker';
import { flags } from '@/entrypoint/utils/targets';
import { SubtitleResult } from './types';
import { makeEmbed } from '../../base';
import { Caption, getCaptionTypeFromUrl, labelToLanguageCode } from '../../captions';
@ -23,7 +21,7 @@ export const fileMoonScraper = makeEmbed({
const embedHtml = load(embedRes);
const evalCode = embedHtml('script').text().match(evalCodeRegex);
if (!evalCode) throw new Error('Failed to find eval code');
const unpacked = unpack(evalCode[1]);
const unpacked = unpack(evalCode[0]);
const file = fileRegex.exec(unpacked);
if (!file?.[1]) throw new Error('Failed to find file');
@ -53,7 +51,7 @@ export const fileMoonScraper = makeEmbed({
id: 'primary',
type: 'hls',
playlist: file[1],
flags: [flags.CORS_ALLOWED],
flags: [],
captions,
},
],

View File

@ -1,5 +1,6 @@
import * as unpacker from 'unpacker';
import { flags } from '@/entrypoint/utils/targets';
import { makeEmbed } from '@/providers/base';
const mixdropBase = 'https://mixdrop.ag';
@ -47,7 +48,7 @@ export const mixdropScraper = makeEmbed({
{
id: 'primary',
type: 'file',
flags: [],
flags: [flags.IP_LOCKED],
captions: [],
qualities: {
unknown: {

View File

@ -1,71 +0,0 @@
import { load } from 'cheerio';
import { flags } from '@/entrypoint/utils/targets';
import { makeEmbed } from '@/providers/base';
type DPlayerSourcesResponse = {
title: string;
id: string;
file: string;
}[];
export const smashyStreamDScraper = makeEmbed({
id: 'smashystream-d',
name: 'SmashyStream (D)',
rank: 71,
async scrape(ctx) {
const mainPageRes = await ctx.proxiedFetcher<string>(ctx.url, {
headers: {
Referer: ctx.url,
},
});
const mainPageRes$ = load(mainPageRes);
const iframeUrl = mainPageRes$('iframe').attr('src');
if (!iframeUrl) throw new Error(`[${this.name}] failed to find iframe url`);
const mainUrl = new URL(iframeUrl);
const iframeRes = await ctx.proxiedFetcher<string>(iframeUrl, {
headers: {
Referer: ctx.url,
},
});
const textFilePath = iframeRes.match(/"file":"([^"]+)"/)?.[1];
const csrfToken = iframeRes.match(/"key":"([^"]+)"/)?.[1];
if (!textFilePath || !csrfToken) throw new Error(`[${this.name}] failed to find text file url or token`);
const textFileUrl = `${mainUrl.origin}${textFilePath}`;
const textFileRes = await ctx.proxiedFetcher<DPlayerSourcesResponse>(textFileUrl, {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'X-CSRF-TOKEN': csrfToken,
Referer: iframeUrl,
},
});
// Playlists in Hindi, English, Tamil and Telugu are available. We only get the english one.
const textFilePlaylist = textFileRes.find((x) => x.title === 'English')?.file;
if (!textFilePlaylist) throw new Error(`[${this.name}] failed to find an english playlist`);
const playlistRes = await ctx.proxiedFetcher<string>(
`${mainUrl.origin}/playlist/${textFilePlaylist.slice(1)}.txt`,
{
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'X-CSRF-TOKEN': csrfToken,
Referer: iframeUrl,
},
},
);
return {
stream: [
{
id: 'primary',
playlist: playlistRes,
type: 'hls',
flags: [flags.CORS_ALLOWED],
captions: [],
},
],
};
},
});

View File

@ -0,0 +1,17 @@
import { makeEmbed } from '@/providers/base';
import { smashyStreamFScraper } from './video1';
export const smashyStreamOScraper = makeEmbed({
// the scraping logic for all smashystream embeds is the same
// all the embeds can be added in the same way
id: 'smashystream-o',
name: 'SmashyStream (O)',
rank: 70,
async scrape(ctx) {
const result = await smashyStreamFScraper.scrape(ctx);
return {
stream: result.stream,
};
},
});

View File

@ -1,16 +1,29 @@
import { flags } from '@/entrypoint/utils/targets';
import { makeEmbed } from '@/providers/base';
import { Caption, getCaptionTypeFromUrl, labelToLanguageCode } from '@/providers/captions';
import { NotFoundError } from '@/utils/errors';
type FPlayerResponse = {
sourceUrls: string[];
subtitleUrls: string;
subtitles: string | null;
};
// if you don't understand how this is reversed
// check https://discord.com/channels/871713465100816424/1186646348137775164/1225644477188935770
// feel free to reach out atpn or ciaran_ds on discord if you've any problems
function decode(str: string): string {
const b = ['U0ZML2RVN0IvRGx4', 'MGNhL0JWb0kvTlM5', 'Ym94LzJTSS9aU0Zj', 'SGJ0L1dGakIvN0dX', 'eE52L1QwOC96N0Yz'];
let formatedB64 = str.slice(2);
for (let i = 4; i > -1; i--) {
formatedB64 = formatedB64.replace(`//${b[i]}`, '');
}
return atob(formatedB64);
}
export const smashyStreamFScraper = makeEmbed({
id: 'smashystream-f',
name: 'SmashyStream (F)',
rank: 70,
rank: 71,
async scrape(ctx) {
const res = await ctx.proxiedFetcher<FPlayerResponse>(ctx.url, {
headers: {
@ -18,15 +31,20 @@ export const smashyStreamFScraper = makeEmbed({
},
});
if (!res.sourceUrls[0]) throw new NotFoundError('No watchable item found');
const playlist = decode(res.sourceUrls[0]);
if (!playlist.includes('.m3u8')) throw new Error('Failed to decode');
const captions: Caption[] =
res.subtitleUrls
.match(/\[([^\]]+)\](https?:\/\/\S+?)(?=,\[|$)/g)
res.subtitles
?.match(/\[([^\]]+)\](https?:\/\/\S+?)(?=,\[|$)/g)
?.map<Caption | null>((entry: string) => {
const match = entry.match(/\[([^\]]+)\](https?:\/\/\S+?)(?=,\[|$)/);
if (match) {
const [, language, url] = match;
if (language && url) {
const languageCode = labelToLanguageCode(language);
const languageCode = labelToLanguageCode(language.replace(/ - .*/, ''));
const captionType = getCaptionTypeFromUrl(url);
if (!languageCode || !captionType) return null;
return {
@ -46,7 +64,7 @@ export const smashyStreamFScraper = makeEmbed({
stream: [
{
id: 'primary',
playlist: res.sourceUrls[0],
playlist,
type: 'hls',
flags: [flags.CORS_ALLOWED],
captions,

View File

@ -1,4 +1,3 @@
import { flags } from '@/entrypoint/utils/targets';
import { makeEmbed } from '@/providers/base';
import { Caption, getCaptionTypeFromUrl, labelToLanguageCode } from '@/providers/captions';
@ -54,7 +53,11 @@ export const vidplayScraper = makeEmbed({
id: 'primary',
type: 'hls',
playlist: source,
flags: [flags.CORS_ALLOWED],
flags: [],
headers: {
Referer: url.origin,
Origin: url.origin,
},
captions,
thumbnailTrack,
},

View File

@ -2,15 +2,18 @@ import { flags } from '@/entrypoint/utils/targets';
import { makeEmbed } from '@/providers/base';
const linkRegex = /'hls': ?'(http.*?)',/;
const tracksRegex = /previewThumbnails:\s{.*src:\["([^"]+)"]/;
export const voeScraper = makeEmbed({
id: 'voe',
name: 'voe.sx',
rank: 180,
async scrape(ctx) {
const embed = await ctx.proxiedFetcher<string>(ctx.url);
const embedRes = await ctx.proxiedFetcher.full<string>(ctx.url);
const embed = embedRes.body;
const playerSrc = embed.match(linkRegex) ?? [];
const thumbnailTrack = embed.match(tracksRegex);
const streamUrl = playerSrc[1];
if (!streamUrl) throw new Error('Stream url not found in embed code');
@ -21,11 +24,19 @@ export const voeScraper = makeEmbed({
type: 'hls',
id: 'primary',
playlist: streamUrl,
flags: [flags.CORS_ALLOWED],
flags: [flags.CORS_ALLOWED, flags.IP_LOCKED],
captions: [],
headers: {
Referer: 'https://voe.sx',
},
...(thumbnailTrack
? {
thumbnailTrack: {
type: 'vtt',
url: new URL(embedRes.finalUrl).origin + thumbnailTrack[1],
},
}
: {}),
},
],
};

View File

@ -0,0 +1,51 @@
import { load } from 'cheerio';
import { unpack } from 'unpacker';
import { flags } from '@/entrypoint/utils/targets';
import { makeEmbed } from '../base';
const evalCodeRegex = /eval\((.*)\)/g;
const fileRegex = /file:"(.*?)"/g;
const tracksRegex = /\{file:"([^"]+)",kind:"thumbnails"\}/g;
export const vTubeScraper = makeEmbed({
id: 'vtube',
name: 'vTube',
rank: 145,
scrape: async (ctx) => {
const mainPageRes = await ctx.proxiedFetcher.full<string>(ctx.url, {
headers: {
referer: ctx.url,
},
});
const mainPage = mainPageRes.body;
const html = load(mainPage);
const evalCode = html('script').text().match(evalCodeRegex);
if (!evalCode) throw new Error('Failed to find eval code');
const unpacked = unpack(evalCode?.toString());
const file = fileRegex.exec(unpacked);
const thumbnailTrack = tracksRegex.exec(unpacked);
if (!file?.[1]) throw new Error('Failed to find file');
return {
stream: [
{
id: 'primary',
type: 'hls',
playlist: file[1],
flags: [flags.CORS_ALLOWED],
captions: [],
...(thumbnailTrack
? {
thumbnailTrack: {
type: 'vtt',
url: new URL(mainPageRes.finalUrl).origin + thumbnailTrack[1],
},
}
: {}),
},
],
};
},
});

View File

@ -54,6 +54,15 @@ async function getStreams(title: string) {
case 'dood.watch':
embedId = 'dood';
break;
case 'dropload.io':
embedId = 'dropload';
break;
case 'filelions.to':
embedId = 'filelions';
break;
case 'vtube.to':
embedId = 'vtube';
break;
default:
embedId = null;
}

View File

@ -19,13 +19,19 @@ const universalScraper = async (ctx: MovieScrapeContext | ShowScrapeContext) =>
q: ctx.media.title,
},
});
const show = searchResult.data.items[0];
if (!show) throw new NotFoundError('No watchable item found');
const mediaData = searchResult.data.items.map((movieEl) => {
const name = movieEl.title;
const year = movieEl.contentable.releaseYear;
const fullSlug = movieEl.fullSlug;
return { name, year, fullSlug };
});
const targetMedia = mediaData.find((m) => m.name === ctx.media.title && m.year === ctx.media.releaseYear.toString());
if (!targetMedia?.fullSlug) throw new NotFoundError('No watchable item found');
let iframeSourceUrl = `/${show.fullSlug}/videos`;
let iframeSourceUrl = `/${targetMedia.fullSlug}/videos`;
if (ctx.media.type === 'show') {
const showPageResult = await ctx.proxiedFetcher<string>(`/${show.fullSlug}`, {
const showPageResult = await ctx.proxiedFetcher<string>(`/${targetMedia.fullSlug}`, {
baseUrl: ridoMoviesBase,
});
const fullEpisodeSlug = `season-${ctx.media.season.number}/episode-${ctx.media.episode.number}`;

View File

@ -1,56 +1,29 @@
import { load } from 'cheerio';
import { flags } from '@/entrypoint/utils/targets';
import { SourcererEmbed, SourcererOutput, makeSourcerer } from '@/providers/base';
import { smashyStreamDScraper } from '@/providers/embeds/smashystream/dued';
import { SourcererOutput, makeSourcerer } from '@/providers/base';
import { smashyStreamOScraper } from '@/providers/embeds/smashystream/opstream';
import { smashyStreamFScraper } from '@/providers/embeds/smashystream/video1';
import { MovieScrapeContext, ShowScrapeContext } from '@/utils/context';
const smashyStreamBase = 'https://embed.smashystream.com';
const referer = 'https://smashystream.com/';
const universalScraper = async (ctx: ShowScrapeContext | MovieScrapeContext): Promise<SourcererOutput> => {
const mainPage = await ctx.proxiedFetcher<string>('/playere.php', {
query: {
tmdb: ctx.media.tmdbId,
...(ctx.media.type === 'show' && {
season: ctx.media.season.number.toString(),
episode: ctx.media.episode.number.toString(),
}),
},
headers: {
Referer: referer,
},
baseUrl: smashyStreamBase,
});
ctx.progress(30);
const mainPage$ = load(mainPage);
const sourceUrls = mainPage$('.dropdown-menu a[data-url]')
.map((_, el) => mainPage$(el).attr('data-url'))
.get();
const embeds: SourcererEmbed[] = [];
for (const sourceUrl of sourceUrls) {
if (sourceUrl.includes('video1d.php')) {
embeds.push({
embedId: smashyStreamFScraper.id,
url: sourceUrl,
});
}
if (sourceUrl.includes('dued.php')) {
embeds.push({
embedId: smashyStreamDScraper.id,
url: sourceUrl,
});
}
}
ctx.progress(60);
// theres no point in fetching the player page
// because it too just calls the api with the tmdb id
// thats the only way to find out if the embed has any streams
const query =
ctx.media.type === 'movie'
? `?tmdb=${ctx.media.tmdbId}`
: `?tmdbId=${ctx.media.tmdbId}&season=${ctx.media.season.number}&episode=${ctx.media.episode.number}`;
return {
embeds,
embeds: [
{
embedId: smashyStreamFScraper.id,
url: `https://embed.smashystream.com/video1dn.php${query}`,
},
{
embedId: smashyStreamOScraper.id,
url: `https://embed.smashystream.com/videoop.php${query}`,
},
],
};
};
@ -59,7 +32,6 @@ export const smashyStreamScraper = makeSourcerer({
name: 'SmashyStream',
rank: 30,
flags: [flags.CORS_ALLOWED],
disabled: true,
scrapeMovie: universalScraper,
scrapeShow: universalScraper,
});

View File

@ -1,7 +1,7 @@
// This file is based on https://github.com/Ciarands/vidsrc-to-resolver/blob/dffa45e726a4b944cb9af0c9e7630476c93c0213/vidsrc.py#L16
// Full credits to @Ciarands!
const DECRYPTION_KEY = '8z5Ag5wgagfsOuhz';
const DECRYPTION_KEY = 'WXrUARXb1aDLaZjI';
export const decodeBase64UrlSafe = (str: string) => {
const standardizedInput = str.replace(/_/g, '/').replace(/-/g, '+');

View File

@ -1,6 +1,5 @@
import { load } from 'cheerio';
import { flags } from '@/entrypoint/utils/targets';
import { SourcererEmbed, SourcererOutput, makeSourcerer } from '@/providers/base';
import { MovieScrapeContext, ShowScrapeContext } from '@/utils/context';
@ -78,6 +77,6 @@ export const vidSrcToScraper = makeSourcerer({
name: 'VidSrcTo',
scrapeMovie: universalScraper,
scrapeShow: universalScraper,
flags: [flags.CORS_ALLOWED],
flags: [],
rank: 130,
});