mirror of
https://github.com/sussy-code/smov.git
synced 2024-12-29 16:07:40 +01:00
feat(netfilm): add captions
This commit is contained in:
parent
139a760be0
commit
25e32a14b7
1 changed files with 18 additions and 4 deletions
|
@ -44,20 +44,27 @@ registerProvider({
|
|||
baseURL: netfilmBase,
|
||||
});
|
||||
|
||||
const { qualities } = watchInfo.data;
|
||||
const data = watchInfo.data;
|
||||
|
||||
// get best quality source
|
||||
const source = qualities.reduce((p: any, c: any) =>
|
||||
const source = data.qualities.reduce((p: any, c: any) =>
|
||||
c.quality > p.quality ? c : p
|
||||
);
|
||||
|
||||
const mappedCaptions = data.subtitles.map((sub: Record<string, any>) => ({
|
||||
needsProxy: false,
|
||||
url: sub.url.replace("https://convert-srt-to-vtt.vercel.app/?url=", ""),
|
||||
type: MWCaptionType.SRT,
|
||||
langIso: sub.language,
|
||||
}))
|
||||
|
||||
return {
|
||||
embeds: [],
|
||||
stream: {
|
||||
streamUrl: source.url.replace("akm-cdn", "aws-cdn").replace("gg-cdn", "aws-cdn"),
|
||||
quality: qualityMap[source.quality as QualityInMap],
|
||||
type: MWStreamType.HLS,
|
||||
captions: [],
|
||||
captions: mappedCaptions,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
@ -112,13 +119,20 @@ registerProvider({
|
|||
c.quality > p.quality ? c : p
|
||||
);
|
||||
|
||||
const mappedCaptions = data.subtitles.map((sub: Record<string, any>) => ({
|
||||
needsProxy: false,
|
||||
url: sub.url.replace("https://convert-srt-to-vtt.vercel.app/?url=", ""),
|
||||
type: MWCaptionType.SRT,
|
||||
langIso: sub.language,
|
||||
}))
|
||||
|
||||
return {
|
||||
embeds: [],
|
||||
stream: {
|
||||
streamUrl: source.url.replace("akm-cdn", "aws-cdn").replace("gg-cdn", "aws-cdn"),
|
||||
quality: qualityMap[source.quality as QualityInMap],
|
||||
type: MWStreamType.HLS,
|
||||
captions: [],
|
||||
captions: mappedCaptions,
|
||||
},
|
||||
};
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue