mirror of
https://github.com/movie-web/movie-web.git
synced 2024-11-11 00:25:05 +01:00
feat(netfilm): add captions
This commit is contained in:
parent
139a760be0
commit
25e32a14b7
@ -44,20 +44,27 @@ registerProvider({
|
|||||||
baseURL: netfilmBase,
|
baseURL: netfilmBase,
|
||||||
});
|
});
|
||||||
|
|
||||||
const { qualities } = watchInfo.data;
|
const data = watchInfo.data;
|
||||||
|
|
||||||
// get best quality source
|
// 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
|
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 {
|
return {
|
||||||
embeds: [],
|
embeds: [],
|
||||||
stream: {
|
stream: {
|
||||||
streamUrl: source.url.replace("akm-cdn", "aws-cdn").replace("gg-cdn", "aws-cdn"),
|
streamUrl: source.url.replace("akm-cdn", "aws-cdn").replace("gg-cdn", "aws-cdn"),
|
||||||
quality: qualityMap[source.quality as QualityInMap],
|
quality: qualityMap[source.quality as QualityInMap],
|
||||||
type: MWStreamType.HLS,
|
type: MWStreamType.HLS,
|
||||||
captions: [],
|
captions: mappedCaptions,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -112,13 +119,20 @@ registerProvider({
|
|||||||
c.quality > p.quality ? c : p
|
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 {
|
return {
|
||||||
embeds: [],
|
embeds: [],
|
||||||
stream: {
|
stream: {
|
||||||
streamUrl: source.url.replace("akm-cdn", "aws-cdn").replace("gg-cdn", "aws-cdn"),
|
streamUrl: source.url.replace("akm-cdn", "aws-cdn").replace("gg-cdn", "aws-cdn"),
|
||||||
quality: qualityMap[source.quality as QualityInMap],
|
quality: qualityMap[source.quality as QualityInMap],
|
||||||
type: MWStreamType.HLS,
|
type: MWStreamType.HLS,
|
||||||
captions: [],
|
captions: mappedCaptions,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user