filter captions with invalid language code or caption type
This commit is contained in:
parent
cb57e0eef4
commit
95ce136863
|
@ -26,10 +26,13 @@ export const smashyStreamFScraper = makeEmbed({
|
||||||
if (match) {
|
if (match) {
|
||||||
const [, language, url] = match;
|
const [, language, url] = match;
|
||||||
if (language && url) {
|
if (language && url) {
|
||||||
|
const languageCode = labelToLanguageCode(language);
|
||||||
|
const captionType = getCaptionTypeFromUrl(url);
|
||||||
|
if (!languageCode || !captionType) return null;
|
||||||
return {
|
return {
|
||||||
url: url.replace(',', ''),
|
url: url.replace(',', ''),
|
||||||
language: labelToLanguageCode(language) ?? '',
|
language: languageCode,
|
||||||
type: getCaptionTypeFromUrl(url) ?? 'vtt',
|
type: captionType,
|
||||||
hasCorsRestrictions: false,
|
hasCorsRestrictions: false,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue