Merge branch 'dev' of https://github.com/infvortx/providers-dev into pr/146
This commit is contained in:
commit
356286dfaa
|
@ -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';
|
||||
|
|
|
@ -1,32 +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[] = [];
|
||||
let subtitle: Subtitle;
|
||||
for (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)
|
||||
}
|
||||
|
||||
captions.push({
|
||||
id: subtitle.url,
|
||||
url: subtitle.url,
|
||||
language,
|
||||
type: 'vtt',
|
||||
hasCorsRestrictions: false,
|
||||
});
|
||||
}
|
||||
captions = removeDuplicatedLanguages(captions);
|
||||
return captions;
|
||||
}
|
||||
|
|
|
@ -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,16 +39,11 @@ export const insertunitScraper = makeSourcerer({
|
|||
);
|
||||
|
||||
if (!currentEpisode?.hls) throw new NotFoundError('No result found');
|
||||
|
||||
let captions: Caption[] = []
|
||||
|
||||
if (currentEpisode.cc != null) {
|
||||
captions = await getCaptions(currentEpisode.cc)
|
||||
}
|
||||
|
||||
ctx.progress(80);
|
||||
|
||||
let captions: Caption[] = [];
|
||||
|
||||
if (currentEpisode.cc != null) {
|
||||
captions = await getCaptions(currentEpisode.cc);
|
||||
}
|
||||
|
||||
ctx.progress(95);
|
||||
|
@ -87,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);
|
|
@ -1,30 +1,30 @@
|
|||
export interface Episode {
|
||||
episode: string;
|
||||
id: number;
|
||||
videoKey: string;
|
||||
hls: string;
|
||||
audio: {
|
||||
names: string[];
|
||||
order: number[];
|
||||
}
|
||||
cc: Subtitle[];
|
||||
duration: number;
|
||||
title: string;
|
||||
download: string;
|
||||
sections: string[]
|
||||
poster: string;
|
||||
preview: {
|
||||
src: string;
|
||||
}
|
||||
export interface Subtitle {
|
||||
url: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface Subtitle {
|
||||
url: string;
|
||||
name: string;
|
||||
export interface Episode {
|
||||
episode: string;
|
||||
id: number;
|
||||
videoKey: string;
|
||||
hls: string;
|
||||
audio: {
|
||||
names: string[];
|
||||
order: number[];
|
||||
};
|
||||
cc: Subtitle[];
|
||||
duration: number;
|
||||
title: string;
|
||||
download: string;
|
||||
sections: string[];
|
||||
poster: string;
|
||||
preview: {
|
||||
src: string;
|
||||
};
|
||||
}
|
||||
|
||||
export interface Season {
|
||||
season: number,
|
||||
blocked: boolean,
|
||||
episodes: Episode[]
|
||||
}
|
||||
season: number;
|
||||
blocked: boolean;
|
||||
episodes: Episode[];
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue