api/rutube: add subtitles
Some checks are pending
CodeQL / Analyze (${{ matrix.language }}) (none, javascript-typescript) (push) Waiting to run
Run service tests / test service functionality (push) Waiting to run
Run service tests / test service: ${{ matrix.service }} (push) Blocked by required conditions
Run tests / check lockfile correctness (push) Waiting to run
Run tests / web sanity check (push) Waiting to run
Run tests / api sanity check (push) Waiting to run

This commit is contained in:
wukko 2025-06-25 20:07:34 +06:00
parent 3dae5b2eb0
commit f4637b746c
No known key found for this signature in database
GPG Key ID: 3E30B3F26C7B4AA2
2 changed files with 14 additions and 0 deletions

View File

@ -221,6 +221,7 @@ export default async function({ host, patternMatch, params, isSession, isApiKey
key: patternMatch.key,
quality: params.videoQuality,
isAudioOnly,
subtitleLang,
});
break;

View File

@ -65,8 +65,21 @@ export default async function(obj) {
artist: play.author.name.trim(),
}
let subtitles;
if (obj.subtitleLang && play.captions?.length) {
const subtitle = play.captions.find(
s => ["webvtt", "srt"].includes(s.format) && s.code.startsWith(obj.subtitleLang)
);
if (subtitle) {
subtitles = subtitle.file;
fileMetadata.sublanguage = obj.subtitleLang;
}
}
return {
urls: matchingQuality.uri,
subtitles,
isHLS: true,
filenameAttributes: {
service: "rutube",