8 Commits

Author SHA1 Message Date
Jorrin
7dfd025aad Merge pull request #156 from Paradox-77/dev
Add support for Filemoon MP4 streams
2024-04-17 17:14:10 +02:00
Exodus-MW
394d740fa0 fix ranking 2024-04-17 19:46:28 +05:30
Exodus-MW
f34580978b Per Joost's request, added Filemoon MP4 2024-04-17 19:31:20 +05:30
Jorrin
39ce1023c2 Merge pull request #154 from ztpn/tugaflix
add Tugaflix source
2024-04-16 22:47:55 +02:00
Jorrin
4f351d91ed Merge branch 'dev' into tugaflix 2024-04-16 22:45:42 +02:00
Jorrin
d639c0b0cf Merge pull request #155 from ztpn/bflix
add nites.is source and bflix embed
2024-04-16 19:21:55 +02:00
TPN
3a9c687d56 adjust ranks 2024-04-16 22:02:57 +05:30
TPN
af22162bfd add source nites and embed bflix 2024-04-16 20:33:06 +05:30
6 changed files with 175 additions and 5 deletions

View File

@@ -23,8 +23,10 @@ import { tugaflixScraper } from '@/providers/sources/tugaflix';
import { vidsrcScraper } from '@/providers/sources/vidsrc/index'; import { vidsrcScraper } from '@/providers/sources/vidsrc/index';
import { zoechipScraper } from '@/providers/sources/zoechip'; import { zoechipScraper } from '@/providers/sources/zoechip';
import { bflixScraper } from './embeds/bflix';
import { closeLoadScraper } from './embeds/closeload'; import { closeLoadScraper } from './embeds/closeload';
import { fileMoonScraper } from './embeds/filemoon'; import { fileMoonScraper } from './embeds/filemoon';
import { fileMoonMp4Scraper } from './embeds/filemoon/mp4';
import { ridooScraper } from './embeds/ridoo'; import { ridooScraper } from './embeds/ridoo';
import { smashyStreamOScraper } from './embeds/smashystream/opstream'; import { smashyStreamOScraper } from './embeds/smashystream/opstream';
import { smashyStreamFScraper } from './embeds/smashystream/video1'; import { smashyStreamFScraper } from './embeds/smashystream/video1';
@@ -39,6 +41,7 @@ import { wootlyScraper } from './embeds/wootly';
import { goojaraScraper } from './sources/goojara'; import { goojaraScraper } from './sources/goojara';
import { hdRezkaScraper } from './sources/hdrezka'; import { hdRezkaScraper } from './sources/hdrezka';
import { nepuScraper } from './sources/nepu'; import { nepuScraper } from './sources/nepu';
import { nitesScraper } from './sources/nites';
import { primewireScraper } from './sources/primewire'; import { primewireScraper } from './sources/primewire';
import { ridooMoviesScraper } from './sources/ridomovies'; import { ridooMoviesScraper } from './sources/ridomovies';
import { smashyStreamScraper } from './sources/smashystream'; import { smashyStreamScraper } from './sources/smashystream';
@@ -66,6 +69,7 @@ export function gatherAllSources(): Array<Sourcerer> {
primewireScraper, primewireScraper,
warezcdnScraper, warezcdnScraper,
insertunitScraper, insertunitScraper,
nitesScraper,
soaperTvScraper, soaperTvScraper,
tugaflixScraper, tugaflixScraper,
]; ];
@@ -89,6 +93,7 @@ export function gatherAllEmbeds(): Array<Embed> {
ridooScraper, ridooScraper,
closeLoadScraper, closeLoadScraper,
fileMoonScraper, fileMoonScraper,
fileMoonMp4Scraper,
vidplayScraper, vidplayScraper,
wootlyScraper, wootlyScraper,
doodScraper, doodScraper,
@@ -100,5 +105,6 @@ export function gatherAllEmbeds(): Array<Embed> {
vTubeScraper, vTubeScraper,
warezcdnembedHlsScraper, warezcdnembedHlsScraper,
warezcdnembedMp4Scraper, warezcdnembedMp4Scraper,
bflixScraper,
]; ];
} }

View File

@@ -0,0 +1,42 @@
import { unpack } from 'unpacker';
import { makeEmbed } from '@/providers/base';
const evalCodeRegex = /eval\((.*)\)/g;
const mp4Regex = /https?:\/\/.*\.mp4/;
export const bflixScraper = makeEmbed({
id: 'bflix',
name: 'bFlix',
rank: 113,
scrape: async (ctx) => {
const mainPage = await ctx.proxiedFetcher<string>(ctx.url);
const evalCode = mainPage.match(evalCodeRegex);
if (!evalCode) throw new Error('Failed to find eval code');
const unpacked = unpack(evalCode[0]);
const file = unpacked.match(mp4Regex);
if (!file?.[0]) throw new Error('Failed to find file');
return {
stream: [
{
id: 'primary',
type: 'file',
flags: [],
captions: [],
qualities: {
unknown: {
type: 'mp4',
url: file[0],
},
},
headers: {
Referer: 'https://bflix.gs/',
},
},
],
};
},
});

View File

@@ -11,7 +11,7 @@ const fileRegex = /file:"(.*?)"/g;
export const fileMoonScraper = makeEmbed({ export const fileMoonScraper = makeEmbed({
id: 'filemoon', id: 'filemoon',
name: 'Filemoon', name: 'Filemoon',
rank: 400, rank: 300,
scrape: async (ctx) => { scrape: async (ctx) => {
const embedRes = await ctx.proxiedFetcher<string>(ctx.url, { const embedRes = await ctx.proxiedFetcher<string>(ctx.url, {
headers: { headers: {

View File

@@ -0,0 +1,37 @@
import { NotFoundError } from '@/utils/errors';
import { makeEmbed } from '../../base';
import { fileMoonScraper } from './index';
export const fileMoonMp4Scraper = makeEmbed({
id: 'filemoon-mp4',
name: 'Filemoon MP4',
rank: 400,
scrape: async (ctx) => {
const result = await fileMoonScraper.scrape(ctx);
if (!result.stream) throw new NotFoundError('Failed to find result');
if (result.stream[0].type !== 'hls') throw new NotFoundError('Failed to find hls stream');
const url = result.stream[0].playlist.replace(/\/hls2\//, '/download/').replace(/\.m3u8/, '.mp4');
return {
stream: [
{
id: 'primary',
type: 'file',
qualities: {
unknown: {
type: 'mp4',
url,
},
},
flags: [],
captions: result.stream[0].captions,
},
],
};
},
});

View File

@@ -0,0 +1,79 @@
import { load } from 'cheerio';
import { SourcererOutput, makeSourcerer } from '@/providers/base';
import { compareMedia } from '@/utils/compare';
import { MovieScrapeContext, ShowScrapeContext } from '@/utils/context';
import { NotFoundError } from '@/utils/errors';
const baseUrl = 'https://w1.nites.is';
async function comboScraper(ctx: ShowScrapeContext | MovieScrapeContext): Promise<SourcererOutput> {
const searchPage = await ctx.proxiedFetcher('/wp-admin/admin-ajax.php', {
baseUrl,
method: 'POST',
body: new URLSearchParams({
action: 'ajax_pagination',
query_vars: 'mixed',
search: ctx.media.title,
}),
});
const $search = load(searchPage);
const searchResults: { title: string; year: number; url: string }[] = [];
$search('li').each((_, element) => {
const title = $search(element).find('.entry-title').first().text().trim();
const year = parseInt($search(element).find('.year').first().text().trim(), 10);
const url = $search(element).find('.lnk-blk').attr('href');
if (!title || !year || !url) return;
searchResults.push({ title, year, url });
});
let watchPageUrl = searchResults.find((x) => x && compareMedia(ctx.media, x.title, x.year))?.url;
if (!watchPageUrl) throw new NotFoundError('No watchable item found');
if (ctx.media.type === 'show') {
const match = watchPageUrl.match(/\/series\/([^/]+)\/?/);
if (!match) throw new Error('Failed to parse watch page url');
watchPageUrl = watchPageUrl.replace(
`/series/${match[1]}`,
`/episode/${match[1]}-${ctx.media.season.number}x${ctx.media.episode.number}`,
);
}
const watchPage = load(await ctx.proxiedFetcher(watchPageUrl));
// it embeds vidsrc when it bflix does not has the stream
// i think all shows embed vidsrc, not sure
const embedUrl = watchPage('ul.bx-lst li a:contains("- Bflix")')
.closest('aside')
.next('div.video-options')
.find('iframe')
.attr('data-lazy-src');
if (!embedUrl) throw new Error('Failed to find embed url');
const embedPage = load(await ctx.proxiedFetcher(embedUrl));
const url = embedPage('iframe').attr('src');
if (!url) throw new Error('Failed to find embed url');
return {
embeds: [
{
embedId: 'bflix',
url,
},
],
};
}
export const nitesScraper = makeSourcerer({
id: 'nites',
name: 'Nites',
rank: 90,
flags: [],
scrapeMovie: comboScraper,
scrapeShow: comboScraper,
});

View File

@@ -60,10 +60,16 @@ const universalScraper = async (ctx: ShowScrapeContext | MovieScrapeContext): Pr
const urlWithSubtitles = embedArr.find((v) => v.source === 'Vidplay' && v.url.includes('sub.info'))?.url; const urlWithSubtitles = embedArr.find((v) => v.source === 'Vidplay' && v.url.includes('sub.info'))?.url;
const subtitleUrl = urlWithSubtitles ? new URL(urlWithSubtitles).searchParams.get('sub.info') : null; const subtitleUrl = urlWithSubtitles ? new URL(urlWithSubtitles).searchParams.get('sub.info') : null;
if (subtitleUrl) fullUrl.searchParams.set('sub.info', subtitleUrl); if (subtitleUrl) fullUrl.searchParams.set('sub.info', subtitleUrl);
embeds.push({ embeds.push(
{
embedId: 'filemoon', embedId: 'filemoon',
url: fullUrl.toString(), url: fullUrl.toString(),
}); },
{
embedId: 'filemoon-mp4',
url: fullUrl.toString(),
},
);
} }
} }