Skip to content

Commit

Permalink
Add theyallsayflix source
Browse files Browse the repository at this point in the history
ztpn committed Jan 10, 2025
1 parent ef7a4c8 commit 88f8842
Showing 2 changed files with 63 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/providers/all.ts
Original file line number Diff line number Diff line change
@@ -29,6 +29,7 @@ import { nsbxScraper } from '@/providers/sources/nsbx';
import { redStarScraper } from '@/providers/sources/redstar';
import { remotestreamScraper } from '@/providers/sources/remotestream';
import { showboxScraper } from '@/providers/sources/showbox/index';
import { TASFScraper } from '@/providers/sources/theyallsayflix';
import { tugaflixScraper } from '@/providers/sources/tugaflix';
import { vidsrcScraper } from '@/providers/sources/vidsrc/index';
import { vidsrcsuScraper } from '@/providers/sources/vidsrcsu';
@@ -106,6 +107,7 @@ export function gatherAllSources(): Array<Sourcerer> {
redStarScraper,
bombtheirishScraper,
vidsrcsuScraper,
TASFScraper,
];
}

61 changes: 61 additions & 0 deletions src/providers/sources/theyallsayflix.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import { flags } from '@/entrypoint/utils/targets';
import { SourcererOutput, makeSourcerer } from '@/providers/base';
import { Caption, labelToLanguageCode } from '@/providers/captions';
import { MovieScrapeContext, ShowScrapeContext } from '@/utils/context';
import { NotFoundError } from '@/utils/errors';

const baseUrl = 'https://theyallsayflix.su/';

async function comboScraper(ctx: ShowScrapeContext | MovieScrapeContext): Promise<SourcererOutput> {
const apiRes = await ctx.proxiedFetcher.full('/api/v1/search', {
query: {
type: ctx.media.type,
tmdb_id: ctx.media.tmdbId,
...(ctx.media.type === 'show' && {
season: ctx.media.season.number.toString(),
episode: ctx.media.episode.number.toString(),
}),
},
baseUrl,
});
const data: { streams: { play_url: string }[]; subtitles: { label: string; url: string }[] } = apiRes.body;

if (apiRes.statusCode !== 200 || !data.streams[0].play_url) throw new NotFoundError('No watchable item found');

const captions: Caption[] = [];
if (data.subtitles) {
for (const caption of data.subtitles) {
const language = labelToLanguageCode(caption.label);
if (!language) continue;
captions.push({
id: caption.url,
url: caption.url,
type: 'vtt',
hasCorsRestrictions: false,
language,
});
}
}

return {
embeds: [],
stream: [
{
id: 'primary',
playlist: data.streams[0].play_url,
type: 'hls',
flags: [flags.CORS_ALLOWED],
captions,
},
],
};
}

export const TASFScraper = makeSourcerer({
id: 'tasf',
name: 'theyallsayflix.su',
rank: 225,
flags: [flags.CORS_ALLOWED],
scrapeMovie: comboScraper,
scrapeShow: comboScraper,
});

0 comments on commit 88f8842

Please sign in to comment.