mirror of
https://github.com/movie-web/providers.git
synced 2025-09-13 13:33:25 +00:00
fix smashystream
This commit is contained in:
@@ -1,9 +1,7 @@
|
|||||||
import { Embed, Sourcerer } from '@/providers/base';
|
import { Embed, Sourcerer } from '@/providers/base';
|
||||||
import { doodScraper } from '@/providers/embeds/dood';
|
import { doodScraper } from '@/providers/embeds/dood';
|
||||||
import { droploadScraper } from '@/providers/embeds/dropload';
|
|
||||||
import { febboxHlsScraper } from '@/providers/embeds/febbox/hls';
|
import { febboxHlsScraper } from '@/providers/embeds/febbox/hls';
|
||||||
import { febboxMp4Scraper } from '@/providers/embeds/febbox/mp4';
|
import { febboxMp4Scraper } from '@/providers/embeds/febbox/mp4';
|
||||||
import { filelionsScraper } from '@/providers/embeds/filelions';
|
|
||||||
import { mixdropScraper } from '@/providers/embeds/mixdrop';
|
import { mixdropScraper } from '@/providers/embeds/mixdrop';
|
||||||
import { mp4uploadScraper } from '@/providers/embeds/mp4upload';
|
import { mp4uploadScraper } from '@/providers/embeds/mp4upload';
|
||||||
import { streambucketScraper } from '@/providers/embeds/streambucket';
|
import { streambucketScraper } from '@/providers/embeds/streambucket';
|
||||||
@@ -11,7 +9,6 @@ import { streamsbScraper } from '@/providers/embeds/streamsb';
|
|||||||
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 { vidsrcembedScraper } from '@/providers/embeds/vidsrc';
|
import { vidsrcembedScraper } from '@/providers/embeds/vidsrc';
|
||||||
import { vTubeScraper } from '@/providers/embeds/vtube';
|
|
||||||
import { flixhqScraper } from '@/providers/sources/flixhq/index';
|
import { flixhqScraper } from '@/providers/sources/flixhq/index';
|
||||||
import { goMoviesScraper } from '@/providers/sources/gomovies/index';
|
import { goMoviesScraper } from '@/providers/sources/gomovies/index';
|
||||||
import { kissAsianScraper } from '@/providers/sources/kissasian/index';
|
import { kissAsianScraper } from '@/providers/sources/kissasian/index';
|
||||||
@@ -24,7 +21,7 @@ import { zoechipScraper } from '@/providers/sources/zoechip';
|
|||||||
import { closeLoadScraper } from './embeds/closeload';
|
import { closeLoadScraper } from './embeds/closeload';
|
||||||
import { fileMoonScraper } from './embeds/filemoon';
|
import { fileMoonScraper } from './embeds/filemoon';
|
||||||
import { ridooScraper } from './embeds/ridoo';
|
import { ridooScraper } from './embeds/ridoo';
|
||||||
import { smashyStreamDScraper } from './embeds/smashystream/dued';
|
import { smashyStreamOScraper } from './embeds/smashystream/opstream';
|
||||||
import { smashyStreamFScraper } from './embeds/smashystream/video1';
|
import { smashyStreamFScraper } from './embeds/smashystream/video1';
|
||||||
import { streamtapeScraper } from './embeds/streamtape';
|
import { streamtapeScraper } from './embeds/streamtape';
|
||||||
import { streamvidScraper } from './embeds/streamvid';
|
import { streamvidScraper } from './embeds/streamvid';
|
||||||
@@ -75,7 +72,7 @@ export function gatherAllEmbeds(): Array<Embed> {
|
|||||||
vidsrcembedScraper,
|
vidsrcembedScraper,
|
||||||
streambucketScraper,
|
streambucketScraper,
|
||||||
smashyStreamFScraper,
|
smashyStreamFScraper,
|
||||||
smashyStreamDScraper,
|
smashyStreamOScraper,
|
||||||
ridooScraper,
|
ridooScraper,
|
||||||
closeLoadScraper,
|
closeLoadScraper,
|
||||||
fileMoonScraper,
|
fileMoonScraper,
|
||||||
@@ -85,8 +82,5 @@ export function gatherAllEmbeds(): Array<Embed> {
|
|||||||
streamvidScraper,
|
streamvidScraper,
|
||||||
voeScraper,
|
voeScraper,
|
||||||
streamtapeScraper,
|
streamtapeScraper,
|
||||||
droploadScraper,
|
|
||||||
filelionsScraper,
|
|
||||||
vTubeScraper,
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@@ -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: [],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
},
|
|
||||||
});
|
|
17
src/providers/embeds/smashystream/opstream.ts
Normal file
17
src/providers/embeds/smashystream/opstream.ts
Normal 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,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
});
|
@@ -1,16 +1,29 @@
|
|||||||
import { flags } from '@/entrypoint/utils/targets';
|
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';
|
||||||
|
import { NotFoundError } from '@/utils/errors';
|
||||||
|
|
||||||
type FPlayerResponse = {
|
type FPlayerResponse = {
|
||||||
sourceUrls: string[];
|
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({
|
export const smashyStreamFScraper = makeEmbed({
|
||||||
id: 'smashystream-f',
|
id: 'smashystream-f',
|
||||||
name: 'SmashyStream (F)',
|
name: 'SmashyStream (F)',
|
||||||
rank: 70,
|
rank: 71,
|
||||||
async scrape(ctx) {
|
async scrape(ctx) {
|
||||||
const res = await ctx.proxiedFetcher<FPlayerResponse>(ctx.url, {
|
const res = await ctx.proxiedFetcher<FPlayerResponse>(ctx.url, {
|
||||||
headers: {
|
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[] =
|
const captions: Caption[] =
|
||||||
res.subtitleUrls
|
res.subtitles
|
||||||
.match(/\[([^\]]+)\](https?:\/\/\S+?)(?=,\[|$)/g)
|
?.match(/\[([^\]]+)\](https?:\/\/\S+?)(?=,\[|$)/g)
|
||||||
?.map<Caption | null>((entry: string) => {
|
?.map<Caption | null>((entry: string) => {
|
||||||
const match = entry.match(/\[([^\]]+)\](https?:\/\/\S+?)(?=,\[|$)/);
|
const match = entry.match(/\[([^\]]+)\](https?:\/\/\S+?)(?=,\[|$)/);
|
||||||
if (match) {
|
if (match) {
|
||||||
const [, language, url] = match;
|
const [, language, url] = match;
|
||||||
if (language && url) {
|
if (language && url) {
|
||||||
const languageCode = labelToLanguageCode(language);
|
const languageCode = labelToLanguageCode(language.replace(/ - .*/, ''));
|
||||||
const captionType = getCaptionTypeFromUrl(url);
|
const captionType = getCaptionTypeFromUrl(url);
|
||||||
if (!languageCode || !captionType) return null;
|
if (!languageCode || !captionType) return null;
|
||||||
return {
|
return {
|
||||||
@@ -46,7 +64,7 @@ export const smashyStreamFScraper = makeEmbed({
|
|||||||
stream: [
|
stream: [
|
||||||
{
|
{
|
||||||
id: 'primary',
|
id: 'primary',
|
||||||
playlist: res.sourceUrls[0],
|
playlist,
|
||||||
type: 'hls',
|
type: 'hls',
|
||||||
flags: [flags.CORS_ALLOWED],
|
flags: [flags.CORS_ALLOWED],
|
||||||
captions,
|
captions,
|
||||||
|
@@ -1,56 +1,29 @@
|
|||||||
import { load } from 'cheerio';
|
|
||||||
|
|
||||||
import { flags } from '@/entrypoint/utils/targets';
|
import { flags } from '@/entrypoint/utils/targets';
|
||||||
import { SourcererEmbed, SourcererOutput, makeSourcerer } from '@/providers/base';
|
import { SourcererOutput, makeSourcerer } from '@/providers/base';
|
||||||
import { smashyStreamDScraper } from '@/providers/embeds/smashystream/dued';
|
import { smashyStreamOScraper } from '@/providers/embeds/smashystream/opstream';
|
||||||
import { smashyStreamFScraper } from '@/providers/embeds/smashystream/video1';
|
import { smashyStreamFScraper } from '@/providers/embeds/smashystream/video1';
|
||||||
import { MovieScrapeContext, ShowScrapeContext } from '@/utils/context';
|
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 universalScraper = async (ctx: ShowScrapeContext | MovieScrapeContext): Promise<SourcererOutput> => {
|
||||||
const mainPage = await ctx.proxiedFetcher<string>('/playere.php', {
|
// theres no point in fetching the player page
|
||||||
query: {
|
// because it too just calls the api with the tmdb id
|
||||||
tmdb: ctx.media.tmdbId,
|
// thats the only way to find out if the embed has any streams
|
||||||
...(ctx.media.type === 'show' && {
|
const query =
|
||||||
season: ctx.media.season.number.toString(),
|
ctx.media.type === 'movie'
|
||||||
episode: ctx.media.episode.number.toString(),
|
? `?tmdb=${ctx.media.tmdbId}`
|
||||||
}),
|
: `?tmdbId=${ctx.media.tmdbId}&season=${ctx.media.season.number}&episode=${ctx.media.episode.number}`;
|
||||||
},
|
|
||||||
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);
|
|
||||||
|
|
||||||
return {
|
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',
|
name: 'SmashyStream',
|
||||||
rank: 30,
|
rank: 30,
|
||||||
flags: [flags.CORS_ALLOWED],
|
flags: [flags.CORS_ALLOWED],
|
||||||
disabled: true,
|
|
||||||
scrapeMovie: universalScraper,
|
scrapeMovie: universalScraper,
|
||||||
scrapeShow: universalScraper,
|
scrapeShow: universalScraper,
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user