From 30560e46a399e2706bca0e48dd20519a4bd7e772 Mon Sep 17 00:00:00 2001 From: TPN Date: Sun, 8 Dec 2024 18:37:36 +0000 Subject: [PATCH] Add bombthe.irish source :skull: and streamwish embed --- src/providers/all.ts | 4 +++ src/providers/embeds/streamwish.ts | 35 +++++++++++++++++++++++++++ src/providers/sources/bombtheirish.ts | 32 ++++++++++++++++++++++++ 3 files changed, 71 insertions(+) create mode 100644 src/providers/embeds/streamwish.ts create mode 100644 src/providers/sources/bombtheirish.ts diff --git a/src/providers/all.ts b/src/providers/all.ts index 30de4ce..e24126a 100644 --- a/src/providers/all.ts +++ b/src/providers/all.ts @@ -8,6 +8,7 @@ import { mixdropScraper } from '@/providers/embeds/mixdrop'; import { mp4uploadScraper } from '@/providers/embeds/mp4upload'; import { streambucketScraper } from '@/providers/embeds/streambucket'; import { streamsbScraper } from '@/providers/embeds/streamsb'; +import { streamwishScraper } from '@/providers/embeds/streamwish'; import { turbovidScraper } from '@/providers/embeds/turbovid'; import { upcloudScraper } from '@/providers/embeds/upcloud'; import { upstreamScraper } from '@/providers/embeds/upstream'; @@ -15,6 +16,7 @@ import { vidsrcembedScraper } from '@/providers/embeds/vidsrc'; import { vTubeScraper } from '@/providers/embeds/vtube'; import { astraScraper, novaScraper, orionScraper } from '@/providers/embeds/whvx'; import { autoembedScraper } from '@/providers/sources/autoembed'; +import { bombtheirishScraper } from '@/providers/sources/bombtheirish'; import { catflixScraper } from '@/providers/sources/catflix'; import { ee3Scraper } from '@/providers/sources/ee3'; import { flixhqScraper } from '@/providers/sources/flixhq/index'; @@ -101,6 +103,7 @@ export function gatherAllSources(): Array { whvxScraper, fsharetvScraper, redStarScraper, + bombtheirishScraper, ]; } @@ -149,5 +152,6 @@ export function gatherAllEmbeds(): Array { novaScraper, astraScraper, orionScraper, + streamwishScraper, ]; } diff --git a/src/providers/embeds/streamwish.ts b/src/providers/embeds/streamwish.ts new file mode 100644 index 0000000..cc64d83 --- /dev/null +++ b/src/providers/embeds/streamwish.ts @@ -0,0 +1,35 @@ +import * as unpacker from 'unpacker'; + +import { flags } from '@/entrypoint/utils/targets'; +import { makeEmbed } from '@/providers/base'; + +const packedRegex = /(eval\(function\(p,a,c,k,e,d\).*\)\)\))/; +const linkRegex = /file:"(https:\/\/[^"]+)"/; + +export const streamwishScraper = makeEmbed({ + id: 'streamwish', + name: 'Streamwish', + rank: 216, + async scrape(ctx) { + const streamRes = await ctx.proxiedFetcher(ctx.url); + const packed = streamRes.match(packedRegex); + + if (!packed) throw new Error('Packed not found'); + + const unpacked = unpacker.unpack(packed[1]); + const link = unpacked.match(linkRegex); + + if (!link) throw new Error('Stream not found'); + return { + stream: [ + { + type: 'hls', + id: 'primary', + playlist: link[1], + flags: [flags.CORS_ALLOWED], + captions: [], + }, + ], + }; + }, +}); diff --git a/src/providers/sources/bombtheirish.ts b/src/providers/sources/bombtheirish.ts new file mode 100644 index 0000000..946ecef --- /dev/null +++ b/src/providers/sources/bombtheirish.ts @@ -0,0 +1,32 @@ +// not a joke, this is a real source +import { load } from 'cheerio'; + +import { flags } from '@/entrypoint/utils/targets'; +import { SourcererEmbed, SourcererOutput, makeSourcerer } from '@/providers/base'; +import { MovieScrapeContext, ShowScrapeContext } from '@/utils/context'; + +async function comboScraper(ctx: ShowScrapeContext | MovieScrapeContext): Promise { + const embedPage = await ctx.proxiedFetcher( + `https://bombthe.irish/embed/${ctx.media.type === 'movie' ? `movie/${ctx.media.tmdbId}` : `tv/${ctx.media.tmdbId}/${ctx.media.season.number}/${ctx.media.episode.number}`}`, + ); + const $ = load(embedPage); + + const embeds: SourcererEmbed[] = []; + + $('#dropdownMenu a').each((_, element) => { + const url = new URL($(element).data('url') as string).searchParams.get('url'); + if (!url) return; + embeds.push({ embedId: $(element).text().toLowerCase(), url: atob(url) }); + }); + + return { embeds }; +} + +export const bombtheirishScraper = makeSourcerer({ + id: 'bombtheirish', + name: 'bombthe.irish', + rank: 50, + flags: [flags.CORS_ALLOWED], + scrapeMovie: comboScraper, + scrapeShow: comboScraper, +});