From d99a22d7348a64150b875649e633892e7fa03c70 Mon Sep 17 00:00:00 2001 From: teddyHV11 Date: Sun, 7 Apr 2024 10:53:09 +0300 Subject: [PATCH 01/10] Add insertunit --- src/providers/all.ts | 2 + src/providers/sources/insertunit.ts | 72 +++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 src/providers/sources/insertunit.ts diff --git a/src/providers/all.ts b/src/providers/all.ts index d20e14b..49521c3 100644 --- a/src/providers/all.ts +++ b/src/providers/all.ts @@ -11,6 +11,7 @@ import { upstreamScraper } from '@/providers/embeds/upstream'; import { vidsrcembedScraper } from '@/providers/embeds/vidsrc'; import { flixhqScraper } from '@/providers/sources/flixhq/index'; import { goMoviesScraper } from '@/providers/sources/gomovies/index'; +import { insertunitScraper } from '@/providers/sources/insertunit'; import { kissAsianScraper } from '@/providers/sources/kissasian/index'; import { lookmovieScraper } from '@/providers/sources/lookmovie'; import { remotestreamScraper } from '@/providers/sources/remotestream'; @@ -55,6 +56,7 @@ export function gatherAllSources(): Array { goojaraScraper, hdRezkaScraper, primewireScraper, + insertunitScraper, ]; } diff --git a/src/providers/sources/insertunit.ts b/src/providers/sources/insertunit.ts new file mode 100644 index 0000000..b9d5f07 --- /dev/null +++ b/src/providers/sources/insertunit.ts @@ -0,0 +1,72 @@ +import { flags } from '@/entrypoint/utils/targets'; +import { makeSourcerer } from '@/providers/base'; +import { NotFoundError } from '@/utils/errors'; + +const insertunitbase = 'https://api.insertunit.ws/'; + +export const insertunitScraper = makeSourcerer({ + id: 'insertunit', + name: 'Insert Unit', + disabled: false, + rank: 60, + flags: [flags.CORS_ALLOWED], + async scrapeShow(ctx) { + const playerData = await ctx.fetcher(`${insertunitbase}/embed/imdb/${ctx.media.imdbId}`); + ctx.progress(30); + + const seasonDataJSONregex = /seasons:(.*)/; + const seasonData = seasonDataJSONregex.exec(playerData); + + if (seasonData === null || seasonData[1] === null) { + throw new NotFoundError('No result found'); + } + ctx.progress(60); + + const seasonTable = JSON.parse(seasonData[1]); + for (const season of seasonTable) { + if (season.season === ctx.media.season.number) { + if (season.episodes[ctx.media.episode.number] && season.episodes[ctx.media.episode.number].hls) { + return { + embeds: [], + stream: [ + { + id: 'primary', + captions: [], + playlist: season.episodes[ctx.media.episode.number].hls, + type: 'hls', + flags: [flags.CORS_ALLOWED], + }, + ], + }; + } + } + } + + throw new NotFoundError('No result found'); + }, + async scrapeMovie(ctx) { + const playerData = await ctx.fetcher(`${insertunitbase}/embed/imdb/${ctx.media.imdbId}`); + ctx.progress(50); + + const streamRegex = /hls: "([^"]*)/; + const streamData = streamRegex.exec(playerData); + + if (streamData === null || streamData[1] === null) { + throw new NotFoundError('No result found'); + } + ctx.progress(90); + + return { + embeds: [], + stream: [ + { + id: 'primary', + type: 'hls', + playlist: streamData[1], + flags: [flags.CORS_ALLOWED], + captions: [], + }, + ], + }; + }, +}); From 8a711265cb7e3b1677ddaaa4bac1e6ff6819eccd Mon Sep 17 00:00:00 2001 From: infvortx <53519839+infvortx@users.noreply.github.com> Date: Sun, 7 Apr 2024 11:48:04 +0300 Subject: [PATCH 02/10] Update insertunit.ts --- src/providers/sources/insertunit.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/providers/sources/insertunit.ts b/src/providers/sources/insertunit.ts index b9d5f07..bf70a51 100644 --- a/src/providers/sources/insertunit.ts +++ b/src/providers/sources/insertunit.ts @@ -6,7 +6,7 @@ const insertunitbase = 'https://api.insertunit.ws/'; export const insertunitScraper = makeSourcerer({ id: 'insertunit', - name: 'Insert Unit', + name: 'Insertunit', disabled: false, rank: 60, flags: [flags.CORS_ALLOWED], From 68fe85065f2c99d61fe95905eaedfbf630d36410 Mon Sep 17 00:00:00 2001 From: teddyHV11 Date: Sun, 7 Apr 2024 11:54:34 +0300 Subject: [PATCH 03/10] Updated provider name --- src/providers/sources/insertunit.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/providers/sources/insertunit.ts b/src/providers/sources/insertunit.ts index b9d5f07..bf70a51 100644 --- a/src/providers/sources/insertunit.ts +++ b/src/providers/sources/insertunit.ts @@ -6,7 +6,7 @@ const insertunitbase = 'https://api.insertunit.ws/'; export const insertunitScraper = makeSourcerer({ id: 'insertunit', - name: 'Insert Unit', + name: 'Insertunit', disabled: false, rank: 60, flags: [flags.CORS_ALLOWED], From 7dc5a5ac8324deb8d1ae1006b5d46058d8e847e2 Mon Sep 17 00:00:00 2001 From: teddyHV11 Date: Sun, 7 Apr 2024 15:33:04 +0300 Subject: [PATCH 04/10] Fix series scraping Series scraping was off for some series, this fixes it + also adds support for episodes that are in multiple parts (continuation of each other) as the provider returns them as a single file in episode ranges. --- src/providers/sources/insertunit.ts | 32 +++++++++++++++-------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/src/providers/sources/insertunit.ts b/src/providers/sources/insertunit.ts index bf70a51..4dd9795 100644 --- a/src/providers/sources/insertunit.ts +++ b/src/providers/sources/insertunit.ts @@ -23,21 +23,23 @@ export const insertunitScraper = makeSourcerer({ ctx.progress(60); const seasonTable = JSON.parse(seasonData[1]); - for (const season of seasonTable) { - if (season.season === ctx.media.season.number) { - if (season.episodes[ctx.media.episode.number] && season.episodes[ctx.media.episode.number].hls) { - return { - embeds: [], - stream: [ - { - id: 'primary', - captions: [], - playlist: season.episodes[ctx.media.episode.number].hls, - type: 'hls', - flags: [flags.CORS_ALLOWED], - }, - ], - }; + for (const seasonElement of seasonTable) { + if (seasonElement.season === ctx.media.season.number) { + for (const episodeElement of seasonElement.episodes) { + if (episodeElement.episode.includes(ctx.media.episode.number)) { + return { + embeds: [], + stream: [ + { + id: 'primary', + captions: [], + playlist: episodeElement.hls, + type: 'hls', + flags: [flags.CORS_ALLOWED], + }, + ], + }; + } } } } From 921c35b3ed0221ffcd55560b73429d0ce2a5d5f1 Mon Sep 17 00:00:00 2001 From: teddyHV11 Date: Tue, 9 Apr 2024 07:16:41 +0300 Subject: [PATCH 05/10] Add caption scraping + types --- src/providers/all.ts | 2 +- src/providers/sources/insertunit.ts | 74 --------- .../sources/insertunit/insertunit.ts | 147 ++++++++++++++++++ src/providers/sources/insertunit/types.ts | 30 ++++ 4 files changed, 178 insertions(+), 75 deletions(-) delete mode 100644 src/providers/sources/insertunit.ts create mode 100644 src/providers/sources/insertunit/insertunit.ts create mode 100644 src/providers/sources/insertunit/types.ts diff --git a/src/providers/all.ts b/src/providers/all.ts index 887290d..675aa36 100644 --- a/src/providers/all.ts +++ b/src/providers/all.ts @@ -14,7 +14,7 @@ import { vidsrcembedScraper } from '@/providers/embeds/vidsrc'; import { vTubeScraper } from '@/providers/embeds/vtube'; import { flixhqScraper } from '@/providers/sources/flixhq/index'; import { goMoviesScraper } from '@/providers/sources/gomovies/index'; -import { insertunitScraper } from '@/providers/sources/insertunit'; +import { insertunitScraper } from '@/providers/sources/insertunit/insertunit'; import { kissAsianScraper } from '@/providers/sources/kissasian/index'; import { lookmovieScraper } from '@/providers/sources/lookmovie'; import { remotestreamScraper } from '@/providers/sources/remotestream'; diff --git a/src/providers/sources/insertunit.ts b/src/providers/sources/insertunit.ts deleted file mode 100644 index 4dd9795..0000000 --- a/src/providers/sources/insertunit.ts +++ /dev/null @@ -1,74 +0,0 @@ -import { flags } from '@/entrypoint/utils/targets'; -import { makeSourcerer } from '@/providers/base'; -import { NotFoundError } from '@/utils/errors'; - -const insertunitbase = 'https://api.insertunit.ws/'; - -export const insertunitScraper = makeSourcerer({ - id: 'insertunit', - name: 'Insertunit', - disabled: false, - rank: 60, - flags: [flags.CORS_ALLOWED], - async scrapeShow(ctx) { - const playerData = await ctx.fetcher(`${insertunitbase}/embed/imdb/${ctx.media.imdbId}`); - ctx.progress(30); - - const seasonDataJSONregex = /seasons:(.*)/; - const seasonData = seasonDataJSONregex.exec(playerData); - - if (seasonData === null || seasonData[1] === null) { - throw new NotFoundError('No result found'); - } - ctx.progress(60); - - const seasonTable = JSON.parse(seasonData[1]); - for (const seasonElement of seasonTable) { - if (seasonElement.season === ctx.media.season.number) { - for (const episodeElement of seasonElement.episodes) { - if (episodeElement.episode.includes(ctx.media.episode.number)) { - return { - embeds: [], - stream: [ - { - id: 'primary', - captions: [], - playlist: episodeElement.hls, - type: 'hls', - flags: [flags.CORS_ALLOWED], - }, - ], - }; - } - } - } - } - - throw new NotFoundError('No result found'); - }, - async scrapeMovie(ctx) { - const playerData = await ctx.fetcher(`${insertunitbase}/embed/imdb/${ctx.media.imdbId}`); - ctx.progress(50); - - const streamRegex = /hls: "([^"]*)/; - const streamData = streamRegex.exec(playerData); - - if (streamData === null || streamData[1] === null) { - throw new NotFoundError('No result found'); - } - ctx.progress(90); - - return { - embeds: [], - stream: [ - { - id: 'primary', - type: 'hls', - playlist: streamData[1], - flags: [flags.CORS_ALLOWED], - captions: [], - }, - ], - }; - }, -}); diff --git a/src/providers/sources/insertunit/insertunit.ts b/src/providers/sources/insertunit/insertunit.ts new file mode 100644 index 0000000..5c89663 --- /dev/null +++ b/src/providers/sources/insertunit/insertunit.ts @@ -0,0 +1,147 @@ +import { flags } from '@/entrypoint/utils/targets'; +import { makeSourcerer } from '@/providers/base'; +import { Caption, removeDuplicatedLanguages } from '@/providers/captions'; +import { NotFoundError } from '@/utils/errors'; + +import { Season, Subtitle } from './types'; + +const insertUnitBase = 'https://api.insertunit.ws/'; + +export const insertunitScraper = makeSourcerer({ + id: 'insertunit', + name: 'Insertunit', + disabled: false, + rank: 60, + flags: [flags.CORS_ALLOWED], + async scrapeShow(ctx) { + const playerData = await ctx.fetcher(`/embed/imdb/${ctx.media.imdbId}`, { + baseUrl: insertUnitBase, + }); + ctx.progress(30); + + const seasonDataJSONregex = /seasons:(.*)/; + const seasonData = seasonDataJSONregex.exec(playerData); + + if (seasonData === null || seasonData[1] === null) { + throw new NotFoundError('No result found'); + } + ctx.progress(60); + + const seasonTable: Season[] = JSON.parse(seasonData[1]) as Season[]; + + const currentSeason = seasonTable.find( + (seasonElement) => seasonElement.season === ctx.media.season.number && !seasonElement.blocked, + ); + + const currentEpisode = currentSeason?.episodes.find((episodeElement) => + episodeElement.episode.includes(ctx.media.episode.number.toString()), + ); + + if (!currentEpisode?.hls) throw new NotFoundError('No result found'); + + let captions: Caption[] = []; + + ctx.progress(80); + + if (currentEpisode.cc != null) { + let subtitle: Subtitle; + for (subtitle of currentEpisode.cc) { + let language = ''; + + if (subtitle.name.includes('Рус')) { + language = 'ru'; + } else if (subtitle.name.includes('Укр')) { + language = 'uk'; + } else if (subtitle.name.includes('Eng')) { + language = 'en'; + } else { + continue; + } + + captions.push({ + id: subtitle.url, + url: subtitle.url, + type: 'vtt', + language, + hasCorsRestrictions: false, + }); + } + captions = removeDuplicatedLanguages(captions); + } + + ctx.progress(95); + + return { + embeds: [], + stream: [ + { + id: 'primary', + playlist: currentEpisode.hls, + type: 'hls', + flags: [flags.CORS_ALLOWED], + captions, + }, + ], + }; + }, + async scrapeMovie(ctx) { + const playerData = await ctx.fetcher(`/embed/imdb/${ctx.media.imdbId}`, { + baseUrl: insertUnitBase, + }); + ctx.progress(35); + + const streamRegex = /hls: "([^"]*)/; + const streamData = streamRegex.exec(playerData); + + if (streamData === null || streamData[1] === null) { + throw new NotFoundError('No result found'); + } + ctx.progress(75); + + const subtitleRegex = /cc: (.*)/; + const subtitleJSONData = subtitleRegex.exec(playerData); + + let captions: Caption[] = []; + + if (subtitleJSONData != null && subtitleJSONData[1] != null) { + const subtitleData = JSON.parse(subtitleJSONData[1]); + let subtitle: Subtitle; + for (subtitle of subtitleData as Subtitle[]) { + let language = ''; + + if (subtitle.name.includes('Рус')) { + language = 'ru'; + } else if (subtitle.name.includes('Укр')) { + language = 'uk'; + } else if (subtitle.name.includes('Eng')) { + language = 'en'; + } else { + continue; + } + + captions.push({ + id: subtitle.url, + url: subtitle.url, + type: 'vtt', + language, + hasCorsRestrictions: false, + }); + } + captions = removeDuplicatedLanguages(captions); + } + + + return { + embeds: [], + stream: [ + { + id: 'primary', + type: 'hls', + playlist: streamData[1], + flags: [flags.CORS_ALLOWED], + captions, + }, + ], + }; + }, +}); diff --git a/src/providers/sources/insertunit/types.ts b/src/providers/sources/insertunit/types.ts new file mode 100644 index 0000000..0649275 --- /dev/null +++ b/src/providers/sources/insertunit/types.ts @@ -0,0 +1,30 @@ +export interface Episode { + episode: string; + id: number; + videoKey: string; + hls: string; + audio: { + names: []; + order: []; + } + cc: [] + duration: number; + title: string; + download: string; + sections: [] + poster: string; + preview: { + src: string; + } +} + +export interface Subtitle { + url: string; + name: string; +} + +export interface Season { + season: number, + blocked: boolean, + episodes: Episode[] +} \ No newline at end of file From 5b836a48396c1780d236d93b01fd6a5b106dc5ba Mon Sep 17 00:00:00 2001 From: teddyHV11 Date: Tue, 9 Apr 2024 17:44:41 +0300 Subject: [PATCH 06/10] Fix mistake done with captions Swap languages and type's place --- src/providers/sources/insertunit/insertunit.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/providers/sources/insertunit/insertunit.ts b/src/providers/sources/insertunit/insertunit.ts index 5c89663..47455ae 100644 --- a/src/providers/sources/insertunit/insertunit.ts +++ b/src/providers/sources/insertunit/insertunit.ts @@ -61,8 +61,8 @@ export const insertunitScraper = makeSourcerer({ captions.push({ id: subtitle.url, url: subtitle.url, - type: 'vtt', language, + type: 'vtt', hasCorsRestrictions: false, }); } @@ -122,14 +122,15 @@ export const insertunitScraper = makeSourcerer({ captions.push({ id: subtitle.url, url: subtitle.url, - type: 'vtt', language, + type: 'vtt', hasCorsRestrictions: false, }); } captions = removeDuplicatedLanguages(captions); } + ctx.progress(90); return { embeds: [], From 5d6b93385ea5da5a7c6481f4e90f065a604c98f5 Mon Sep 17 00:00:00 2001 From: teddyHV11 Date: Wed, 10 Apr 2024 07:24:53 +0300 Subject: [PATCH 07/10] Types adjustment, extract captions to a function --- src/providers/sources/insertunit/captions.ts | 32 +++++++++++ .../sources/insertunit/insertunit.ts | 54 +++---------------- src/providers/sources/insertunit/types.ts | 8 +-- 3 files changed, 43 insertions(+), 51 deletions(-) create mode 100644 src/providers/sources/insertunit/captions.ts diff --git a/src/providers/sources/insertunit/captions.ts b/src/providers/sources/insertunit/captions.ts new file mode 100644 index 0000000..92ac7d9 --- /dev/null +++ b/src/providers/sources/insertunit/captions.ts @@ -0,0 +1,32 @@ +import { Caption } from "@/providers/captions"; +import { Subtitle } from "./types"; + +import { removeDuplicatedLanguages } from "@/providers/captions"; + +export async function getCaptions(data: Subtitle[]) { + let captions: Caption[] = []; + let subtitle: Subtitle; + for (subtitle of data) { + let language = ''; + + if (subtitle.name.includes('Рус')) { + language = 'ru'; + } else if (subtitle.name.includes('Укр')) { + language = 'uk'; + } else if (subtitle.name.includes('Eng')) { + language = 'en'; + } else { + continue; + } + + captions.push({ + id: subtitle.url, + url: subtitle.url, + language, + type: 'vtt', + hasCorsRestrictions: false, + }); + } + captions = removeDuplicatedLanguages(captions); + return(captions) +} \ No newline at end of file diff --git a/src/providers/sources/insertunit/insertunit.ts b/src/providers/sources/insertunit/insertunit.ts index 47455ae..3cecf52 100644 --- a/src/providers/sources/insertunit/insertunit.ts +++ b/src/providers/sources/insertunit/insertunit.ts @@ -2,6 +2,7 @@ import { flags } from '@/entrypoint/utils/targets'; import { makeSourcerer } from '@/providers/base'; import { Caption, removeDuplicatedLanguages } from '@/providers/captions'; import { NotFoundError } from '@/utils/errors'; +import { getCaptions } from './captions'; import { Season, Subtitle } from './types'; @@ -38,35 +39,16 @@ export const insertunitScraper = makeSourcerer({ ); if (!currentEpisode?.hls) throw new NotFoundError('No result found'); + + let captions: Caption[] = [] - let captions: Caption[] = []; + if (currentEpisode.cc != null) { + captions = await getCaptions(currentEpisode.cc) + } ctx.progress(80); if (currentEpisode.cc != null) { - let subtitle: Subtitle; - for (subtitle of currentEpisode.cc) { - let language = ''; - - if (subtitle.name.includes('Рус')) { - language = 'ru'; - } else if (subtitle.name.includes('Укр')) { - language = 'uk'; - } else if (subtitle.name.includes('Eng')) { - language = 'en'; - } else { - continue; - } - - captions.push({ - id: subtitle.url, - url: subtitle.url, - language, - type: 'vtt', - hasCorsRestrictions: false, - }); - } - captions = removeDuplicatedLanguages(captions); } ctx.progress(95); @@ -105,29 +87,7 @@ export const insertunitScraper = makeSourcerer({ if (subtitleJSONData != null && subtitleJSONData[1] != null) { const subtitleData = JSON.parse(subtitleJSONData[1]); - let subtitle: Subtitle; - for (subtitle of subtitleData as Subtitle[]) { - let language = ''; - - if (subtitle.name.includes('Рус')) { - language = 'ru'; - } else if (subtitle.name.includes('Укр')) { - language = 'uk'; - } else if (subtitle.name.includes('Eng')) { - language = 'en'; - } else { - continue; - } - - captions.push({ - id: subtitle.url, - url: subtitle.url, - language, - type: 'vtt', - hasCorsRestrictions: false, - }); - } - captions = removeDuplicatedLanguages(captions); + captions = await getCaptions(subtitleData) } ctx.progress(90); diff --git a/src/providers/sources/insertunit/types.ts b/src/providers/sources/insertunit/types.ts index 0649275..282c3c4 100644 --- a/src/providers/sources/insertunit/types.ts +++ b/src/providers/sources/insertunit/types.ts @@ -4,14 +4,14 @@ export interface Episode { videoKey: string; hls: string; audio: { - names: []; - order: []; + names: string[]; + order: number[]; } - cc: [] + cc: Subtitle[]; duration: number; title: string; download: string; - sections: [] + sections: string[] poster: string; preview: { src: string; From 6b038a288c7eab22bfc079b2c1c4b3eaa8c4af99 Mon Sep 17 00:00:00 2001 From: teddyHV11 Date: Thu, 11 Apr 2024 03:57:42 +0300 Subject: [PATCH 08/10] Clarity fixes --- src/providers/sources/insertunit/captions.ts | 3 +-- src/providers/sources/insertunit/insertunit.ts | 5 ----- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/src/providers/sources/insertunit/captions.ts b/src/providers/sources/insertunit/captions.ts index 92ac7d9..74fa166 100644 --- a/src/providers/sources/insertunit/captions.ts +++ b/src/providers/sources/insertunit/captions.ts @@ -5,8 +5,7 @@ import { removeDuplicatedLanguages } from "@/providers/captions"; export async function getCaptions(data: Subtitle[]) { let captions: Caption[] = []; - let subtitle: Subtitle; - for (subtitle of data) { + for (const subtitle of data) { let language = ''; if (subtitle.name.includes('Рус')) { diff --git a/src/providers/sources/insertunit/insertunit.ts b/src/providers/sources/insertunit/insertunit.ts index 3cecf52..104deff 100644 --- a/src/providers/sources/insertunit/insertunit.ts +++ b/src/providers/sources/insertunit/insertunit.ts @@ -46,11 +46,6 @@ export const insertunitScraper = makeSourcerer({ captions = await getCaptions(currentEpisode.cc) } - ctx.progress(80); - - if (currentEpisode.cc != null) { - } - ctx.progress(95); return { From 8796b39a6312696238ec57e34ed2c9db14ec62ea Mon Sep 17 00:00:00 2001 From: teddyHV11 Date: Thu, 11 Apr 2024 04:18:38 +0300 Subject: [PATCH 09/10] Fix prettier errors --- src/providers/sources/insertunit/captions.ts | 51 +++++++++---------- .../sources/insertunit/insertunit.ts | 14 ++--- 2 files changed, 32 insertions(+), 33 deletions(-) diff --git a/src/providers/sources/insertunit/captions.ts b/src/providers/sources/insertunit/captions.ts index 74fa166..881c9c2 100644 --- a/src/providers/sources/insertunit/captions.ts +++ b/src/providers/sources/insertunit/captions.ts @@ -1,31 +1,30 @@ -import { Caption } from "@/providers/captions"; -import { Subtitle } from "./types"; +import { Caption, removeDuplicatedLanguages } from '@/providers/captions'; -import { removeDuplicatedLanguages } from "@/providers/captions"; +import { Subtitle } from './types'; export async function getCaptions(data: Subtitle[]) { - let captions: Caption[] = []; - for (const subtitle of data) { - let language = ''; + let captions: Caption[] = []; + for (const subtitle of data) { + let language = ''; - if (subtitle.name.includes('Рус')) { - language = 'ru'; - } else if (subtitle.name.includes('Укр')) { - language = 'uk'; - } else if (subtitle.name.includes('Eng')) { - language = 'en'; - } else { - continue; - } - - captions.push({ - id: subtitle.url, - url: subtitle.url, - language, - type: 'vtt', - hasCorsRestrictions: false, - }); + if (subtitle.name.includes('Рус')) { + language = 'ru'; + } else if (subtitle.name.includes('Укр')) { + language = 'uk'; + } else if (subtitle.name.includes('Eng')) { + language = 'en'; + } else { + continue; } - captions = removeDuplicatedLanguages(captions); - return(captions) -} \ No newline at end of file + + captions.push({ + id: subtitle.url, + url: subtitle.url, + language, + type: 'vtt', + hasCorsRestrictions: false, + }); + } + captions = removeDuplicatedLanguages(captions); + return captions; +} diff --git a/src/providers/sources/insertunit/insertunit.ts b/src/providers/sources/insertunit/insertunit.ts index 104deff..9a54866 100644 --- a/src/providers/sources/insertunit/insertunit.ts +++ b/src/providers/sources/insertunit/insertunit.ts @@ -1,10 +1,10 @@ import { flags } from '@/entrypoint/utils/targets'; import { makeSourcerer } from '@/providers/base'; -import { Caption, removeDuplicatedLanguages } from '@/providers/captions'; +import { Caption } from '@/providers/captions'; import { NotFoundError } from '@/utils/errors'; -import { getCaptions } from './captions'; -import { Season, Subtitle } from './types'; +import { getCaptions } from './captions'; +import { Season } from './types'; const insertUnitBase = 'https://api.insertunit.ws/'; @@ -39,11 +39,11 @@ export const insertunitScraper = makeSourcerer({ ); if (!currentEpisode?.hls) throw new NotFoundError('No result found'); - - let captions: Caption[] = [] + + let captions: Caption[] = []; if (currentEpisode.cc != null) { - captions = await getCaptions(currentEpisode.cc) + captions = await getCaptions(currentEpisode.cc); } ctx.progress(95); @@ -82,7 +82,7 @@ export const insertunitScraper = makeSourcerer({ if (subtitleJSONData != null && subtitleJSONData[1] != null) { const subtitleData = JSON.parse(subtitleJSONData[1]); - captions = await getCaptions(subtitleData) + captions = await getCaptions(subtitleData); } ctx.progress(90); From 8281c3141aa04c4444ec44ad120527e827e3cf72 Mon Sep 17 00:00:00 2001 From: teddyHV11 Date: Thu, 11 Apr 2024 06:31:53 +0300 Subject: [PATCH 10/10] Rename insertunit.ts to index.ts --- src/providers/all.ts | 2 +- src/providers/sources/insertunit/{insertunit.ts => index.ts} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename src/providers/sources/insertunit/{insertunit.ts => index.ts} (100%) diff --git a/src/providers/all.ts b/src/providers/all.ts index 675aa36..887290d 100644 --- a/src/providers/all.ts +++ b/src/providers/all.ts @@ -14,7 +14,7 @@ import { vidsrcembedScraper } from '@/providers/embeds/vidsrc'; import { vTubeScraper } from '@/providers/embeds/vtube'; import { flixhqScraper } from '@/providers/sources/flixhq/index'; import { goMoviesScraper } from '@/providers/sources/gomovies/index'; -import { insertunitScraper } from '@/providers/sources/insertunit/insertunit'; +import { insertunitScraper } from '@/providers/sources/insertunit'; import { kissAsianScraper } from '@/providers/sources/kissasian/index'; import { lookmovieScraper } from '@/providers/sources/lookmovie'; import { remotestreamScraper } from '@/providers/sources/remotestream'; diff --git a/src/providers/sources/insertunit/insertunit.ts b/src/providers/sources/insertunit/index.ts similarity index 100% rename from src/providers/sources/insertunit/insertunit.ts rename to src/providers/sources/insertunit/index.ts