filter captions with invalid language code or caption type

This commit is contained in:
Jorrin 2023-12-18 21:23:59 +01:00
parent cb57e0eef4
commit 95ce136863
1 changed files with 5 additions and 2 deletions

View File

@ -26,10 +26,13 @@ export const smashyStreamFScraper = makeEmbed({
if (match) {
const [, language, url] = match;
if (language && url) {
const languageCode = labelToLanguageCode(language);
const captionType = getCaptionTypeFromUrl(url);
if (!languageCode || !captionType) return null;
return {
url: url.replace(',', ''),
language: labelToLanguageCode(language) ?? '',
type: getCaptionTypeFromUrl(url) ?? 'vtt',
language: languageCode,
type: captionType,
hasCorsRestrictions: false,
};
}