diff --git a/src/providers/all.ts b/src/providers/all.ts index cdc5402..90903a6 100644 --- a/src/providers/all.ts +++ b/src/providers/all.ts @@ -25,11 +25,13 @@ import { tugaflixScraper } from '@/providers/sources/tugaflix'; import { vidsrcScraper } from '@/providers/sources/vidsrc/index'; import { zoechipScraper } from '@/providers/sources/zoechip'; -import { autoembedBenagaliScraper } from './embeds/autoembed/bengali'; -import { autoembedEnglishScraper } from './embeds/autoembed/english'; -import { autoembedHindiScraper } from './embeds/autoembed/hindi'; -import { autoembedTamilScraper } from './embeds/autoembed/tamil'; -import { autoembedTeluguScraper } from './embeds/autoembed/telugu'; +import { + autoembedBengaliScraper, + autoembedEnglishScraper, + autoembedHindiScraper, + autoembedTamilScraper, + autoembedTeluguScraper, +} from './embeds/autoembed'; import { bflixScraper } from './embeds/bflix'; import { closeLoadScraper } from './embeds/closeload'; import { fileMoonScraper } from './embeds/filemoon'; @@ -126,7 +128,7 @@ export function gatherAllEmbeds(): Array { hydraxScraper, autoembedEnglishScraper, autoembedHindiScraper, - autoembedBenagaliScraper, + autoembedBengaliScraper, autoembedTamilScraper, autoembedTeluguScraper, ]; diff --git a/src/providers/embeds/autoembed.ts b/src/providers/embeds/autoembed.ts new file mode 100644 index 0000000..50d153a --- /dev/null +++ b/src/providers/embeds/autoembed.ts @@ -0,0 +1,54 @@ +import { flags } from '@/entrypoint/utils/targets'; +import { makeEmbed } from '@/providers/base'; + +const providers = [ + { + id: 'autoembed-english', + rank: 10, + }, + { + id: 'autoembed-hindi', + rank: 9, + }, + { + id: 'autoembed-tamil', + rank: 8, + }, + { + id: 'autoembed-telugu', + rank: 7, + }, + { + id: 'autoembed-bengali', + rank: 6, + }, +]; + +function embed(provider: { id: string; rank: number }) { + return makeEmbed({ + id: provider.id, + name: provider.id.charAt(0).toUpperCase() + provider.id.slice(1), + rank: provider.rank, + async scrape(ctx) { + return { + stream: [ + { + id: 'primary', + type: 'hls', + playlist: ctx.url, + flags: [flags.CORS_ALLOWED], + captions: [], + }, + ], + }; + }, + }); +} + +export const [ + autoembedEnglishScraper, + autoembedHindiScraper, + autoembedBengaliScraper, + autoembedTamilScraper, + autoembedTeluguScraper, +] = providers.map(embed); diff --git a/src/providers/embeds/autoembed/bengali.ts b/src/providers/embeds/autoembed/bengali.ts deleted file mode 100644 index 50e5376..0000000 --- a/src/providers/embeds/autoembed/bengali.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { makeEmbed } from '@/providers/base'; - -import { autoembedEnglishScraper } from './english'; - -export const autoembedBenagaliScraper = makeEmbed({ - id: 'autoembed-bengali', - name: 'Bengali', - rank: 7, - async scrape(ctx) { - const result = await autoembedEnglishScraper.scrape(ctx); - return { - stream: result.stream, - }; - }, -}); diff --git a/src/providers/embeds/autoembed/english.ts b/src/providers/embeds/autoembed/english.ts deleted file mode 100644 index 168ae0d..0000000 --- a/src/providers/embeds/autoembed/english.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { flags } from '@/entrypoint/utils/targets'; -import { makeEmbed } from '@/providers/base'; - -export const autoembedEnglishScraper = makeEmbed({ - id: 'autoembed-english', - name: 'English', - rank: 10, - scrape: async (ctx) => { - return { - stream: [ - { - id: 'primary', - type: 'hls', - playlist: ctx.url, - flags: [flags.CORS_ALLOWED], - captions: [], - }, - ], - }; - }, -}); diff --git a/src/providers/embeds/autoembed/hindi.ts b/src/providers/embeds/autoembed/hindi.ts deleted file mode 100644 index 2532d47..0000000 --- a/src/providers/embeds/autoembed/hindi.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { makeEmbed } from '@/providers/base'; - -import { autoembedEnglishScraper } from './english'; - -export const autoembedHindiScraper = makeEmbed({ - id: 'autoembed-hindi', - name: 'Hindi', - rank: 9, - async scrape(ctx) { - const result = await autoembedEnglishScraper.scrape(ctx); - return { - stream: result.stream, - }; - }, -}); diff --git a/src/providers/embeds/autoembed/tamil.ts b/src/providers/embeds/autoembed/tamil.ts deleted file mode 100644 index c395b8e..0000000 --- a/src/providers/embeds/autoembed/tamil.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { makeEmbed } from '@/providers/base'; - -import { autoembedEnglishScraper } from './english'; - -export const autoembedTamilScraper = makeEmbed({ - id: 'autoembed-tamil', - name: 'Tamil', - rank: 8, - async scrape(ctx) { - const result = await autoembedEnglishScraper.scrape(ctx); - return { - stream: result.stream, - }; - }, -}); diff --git a/src/providers/embeds/autoembed/telugu.ts b/src/providers/embeds/autoembed/telugu.ts deleted file mode 100644 index 52dc608..0000000 --- a/src/providers/embeds/autoembed/telugu.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { makeEmbed } from '@/providers/base'; - -import { autoembedEnglishScraper } from './english'; - -export const autoembedTeluguScraper = makeEmbed({ - id: 'autoembed-telugu', - name: 'Telugu', - rank: 6, - async scrape(ctx) { - const result = await autoembedEnglishScraper.scrape(ctx); - return { - stream: result.stream, - }; - }, -});