diff --git a/src/providers/all.ts b/src/providers/all.ts index 4a91539..ba7d79a 100644 --- a/src/providers/all.ts +++ b/src/providers/all.ts @@ -27,6 +27,7 @@ import { } from './embeds/autoembed'; import { cinemaosEmbeds } from './embeds/cinemaos'; import { closeLoadScraper } from './embeds/closeload'; +import { madplayBaseEmbed, madplayNsapiEmbed } from './embeds/madplay'; import { mp4hydraServer1Scraper, mp4hydraServer2Scraper } from './embeds/mp4hydra'; import { ridooScraper } from './embeds/ridoo'; import { streamtapeLatinoScraper, streamtapeScraper } from './embeds/streamtape'; @@ -63,10 +64,10 @@ import { cinemaosScraper } from './sources/cinemaos'; import { coitusScraper } from './sources/coitus'; import { cuevana3Scraper } from './sources/cuevana3'; import { embedsuScraper } from './sources/embedsu'; -import { flickyScraper } from './sources/flicky'; import { hdRezkaScraper } from './sources/hdrezka'; import { iosmirrorScraper } from './sources/iosmirror'; import { iosmirrorPVScraper } from './sources/iosmirrorpv'; +import { madplayScraper } from './sources/madplay'; import { nunflixScraper } from './sources/nunflix'; import { ridooMoviesScraper } from './sources/ridomovies'; import { slidemoviesScraper } from './sources/slidemovies'; @@ -111,7 +112,7 @@ export function gatherAllSources(): Array { pirxcyScraper, vidsrcvipScraper, vidsrccxScraper, - flickyScraper, + madplayScraper, ]; } @@ -161,5 +162,7 @@ export function gatherAllEmbeds(): Array { vidsrcNovaEmbed, vidsrcCometEmbed, vidsrcPulsarEmbed, + madplayBaseEmbed, + madplayNsapiEmbed, ]; } diff --git a/src/providers/embeds/madplay.ts b/src/providers/embeds/madplay.ts new file mode 100644 index 0000000..eff39d8 --- /dev/null +++ b/src/providers/embeds/madplay.ts @@ -0,0 +1,151 @@ +import { flags } from '@/entrypoint/utils/targets'; +import { NotFoundError } from '@/utils/errors'; +import { createM3U8ProxyUrl } from '@/utils/proxy'; + +import { EmbedOutput, makeEmbed } from '../base'; + +const baseUrl = 'madplay.site'; +const headers = { + referer: 'https://madplay.site/', + origin: 'https://madplay.site', + 'User-Agent': + 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36', +}; + +export const madplayBaseEmbed = makeEmbed({ + id: 'madplay-base', + name: 'Flicky Base', + rank: 104, + async scrape(ctx): Promise { + const query = JSON.parse(ctx.url); + const { type, tmdbId, season, episode } = query; + + let url = `https://${baseUrl}/api/playsrc`; + + if (type === 'movie') { + url += `?id=${tmdbId}`; + } else if (type === 'show') { + url += `?id=${tmdbId}&season=${season.number}&episode=${episode.number}`; + } else { + throw new NotFoundError('Unsupported media type'); + } + + const res = await ctx.proxiedFetcher(url, { headers }); + + if (!Array.isArray(res) || res.length === 0) { + throw new NotFoundError('No streams found'); + } + const stream = res[0]; + + if (!stream.file) { + throw new NotFoundError('No file URL found in stream'); + } + + ctx.progress(100); + + return { + stream: [ + { + id: 'primary', + type: 'hls', + playlist: createM3U8ProxyUrl(stream.file, headers), + flags: [flags.CORS_ALLOWED], + captions: [], + }, + ], + }; + }, +}); + +export const madplayNsapiEmbed = makeEmbed({ + id: 'madplay-nsapi', + name: 'Flicky Northstar', + rank: 103, + async scrape(ctx): Promise { + const query = JSON.parse(ctx.url); + const { type, tmdbId, season, episode } = query; + + let url = `https://${baseUrl}/api/nsapi/vid`; + + if (type === 'movie') { + url += `?id=${tmdbId}`; + } else if (type === 'show') { + url += `?id=${tmdbId}&season=${season.number}&episode=${episode.number}`; + } else { + throw new NotFoundError('Unsupported media type'); + } + + const res = await ctx.proxiedFetcher(url, { headers }); + + if (!Array.isArray(res) || res.length === 0) { + throw new NotFoundError('No streams found'); + } + const stream = res[0]; + + if (!stream.url) { + throw new NotFoundError('No file URL found in stream'); + } + + ctx.progress(100); + + return { + stream: [ + { + id: 'primary', + type: 'hls', + playlist: createM3U8ProxyUrl(stream.url, stream.headers || headers), + flags: [flags.CORS_ALLOWED], + captions: [], + }, + ], + }; + }, +}); + +// Will show error: { error: 'Streamkey not found' } + +// export const madplayHollyEmbed = makeEmbed({ +// id: 'madplay-holly', +// name: 'Flicky Woods', +// rank: 102, +// async scrape(ctx): Promise { +// const query = JSON.parse(ctx.url); +// const { type, tmdbId, season, episode } = query; + +// let url = `https://${baseUrl}/api/holly`; + +// if (type === 'movie') { +// url += `?id=${tmdbId}&token=direct`; +// } else if (type === 'show') { +// url += `?id=${tmdbId}&s=${season.number}&e=${episode.number}&token=direct`; +// } else { +// throw new NotFoundError('Unsupported media type'); +// } + +// const res = await ctx.proxiedFetcher(url, { headers }); +// console.log(res); + +// if (!Array.isArray(res) || res.length === 0) { +// throw new NotFoundError('No streams found'); +// } +// const stream = res[0]; + +// if (!stream.url) { +// throw new NotFoundError('No file URL found in stream'); +// } + +// ctx.progress(100); + +// return { +// stream: [ +// { +// id: 'primary', +// type: 'hls', +// playlist: createM3U8ProxyUrl(stream.url, stream.headers || headers), +// flags: [flags.CORS_ALLOWED], +// captions: [], +// }, +// ], +// }; +// }, +// }); diff --git a/src/providers/sources/flicky.ts b/src/providers/sources/flicky.ts deleted file mode 100644 index 5ba0235..0000000 --- a/src/providers/sources/flicky.ts +++ /dev/null @@ -1,62 +0,0 @@ -import { flags } from '@/entrypoint/utils/targets'; -import { SourcererOutput, makeSourcerer } from '@/providers/base'; -import { MovieScrapeContext, ShowScrapeContext } from '@/utils/context'; -import { NotFoundError } from '@/utils/errors'; -import { createM3U8ProxyUrl } from '@/utils/proxy'; - -const baseUrl = 'madplay.site'; -const headers = { - referer: 'https://madplay.site/', - origin: 'https://madplay.site', - 'User-Agent': - 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36', -}; - -async function comboScraper(ctx: MovieScrapeContext | ShowScrapeContext): Promise { - const { media } = ctx; - let url = `https://${baseUrl}/api/playsrc`; - - if (media.type === 'movie') { - url += `?id=${media.tmdbId}`; - } else if (media.type === 'show') { - const { tmdbId, season, episode } = media; - url += `?id=${tmdbId}&season=${season.number}&episode=${episode.number}`; - } else { - throw new NotFoundError('Unsupported media type'); - } - - const res = await ctx.proxiedFetcher(url, { headers }); - - if (!Array.isArray(res) || res.length === 0) { - throw new NotFoundError('No streams found'); - } - const stream = res[0]; - - if (!stream.file) { - throw new NotFoundError('No file URL found in stream'); - } - - ctx.progress(100); - - return { - stream: [ - { - id: 'primary', - type: 'hls', - playlist: createM3U8ProxyUrl(stream.file, headers), - flags: [flags.CORS_ALLOWED], - captions: [], - }, - ], - embeds: [], - }; -} - -export const flickyScraper = makeSourcerer({ - id: 'flicky', - name: 'Flicky', - rank: 155, - flags: [flags.CORS_ALLOWED], - scrapeMovie: comboScraper, - scrapeShow: comboScraper, -}); diff --git a/src/providers/sources/madplay.ts b/src/providers/sources/madplay.ts new file mode 100644 index 0000000..e30352f --- /dev/null +++ b/src/providers/sources/madplay.ts @@ -0,0 +1,39 @@ +import { flags } from '@/entrypoint/utils/targets'; +import { SourcererOutput, makeSourcerer } from '@/providers/base'; +import { MovieScrapeContext, ShowScrapeContext } from '@/utils/context'; + +async function comboScraper(ctx: ShowScrapeContext | MovieScrapeContext): Promise { + const query = { + type: ctx.media.type, + title: ctx.media.title, + tmdbId: ctx.media.tmdbId, + imdbId: ctx.media.imdbId, + ...(ctx.media.type === 'show' && { + season: ctx.media.season.number, + episode: ctx.media.episode.number, + }), + releaseYear: ctx.media.releaseYear, + }; + + const embeds = [ + { + embedId: 'madplay-base', + url: JSON.stringify(query), + }, + { + embedId: 'madplay-nsapi', + url: JSON.stringify(query), + }, + ]; + + return { embeds }; +} + +export const madplayScraper = makeSourcerer({ + id: 'madplay', + name: 'Flicky', + rank: 155, + flags: [flags.CORS_ALLOWED], + scrapeMovie: comboScraper, + scrapeShow: comboScraper, +});