diff --git a/api/src/processing/match-action.js b/api/src/processing/match-action.js index b5c70409..c17158f7 100644 --- a/api/src/processing/match-action.js +++ b/api/src/processing/match-action.js @@ -169,6 +169,7 @@ export default function({ } break; + case "vk": case "tiktok": params = { type: r.subtitles ? "remux" : "proxy" @@ -176,7 +177,6 @@ export default function({ break; case "ok": - case "vk": case "xiaohongshu": params = { type: "proxy" }; break; diff --git a/api/src/processing/match.js b/api/src/processing/match.js index 90e60186..fb0c9588 100644 --- a/api/src/processing/match.js +++ b/api/src/processing/match.js @@ -92,7 +92,8 @@ export default async function({ host, patternMatch, params, isSession, isApiKey ownerId: patternMatch.ownerId, videoId: patternMatch.videoId, accessKey: patternMatch.accessKey, - quality: params.videoQuality + quality: params.videoQuality, + subtitleLang, }); break; diff --git a/api/src/processing/services/vk.js b/api/src/processing/services/vk.js index 33224d69..f871588a 100644 --- a/api/src/processing/services/vk.js +++ b/api/src/processing/services/vk.js @@ -76,7 +76,7 @@ const getVideo = async (ownerId, videoId, accessKey) => { return video; } -export default async function ({ ownerId, videoId, accessKey, quality }) { +export default async function ({ ownerId, videoId, accessKey, quality, subtitleLang }) { const token = await getToken(); if (!token) return { error: "fetch.fail" }; @@ -125,8 +125,20 @@ export default async function ({ ownerId, videoId, accessKey, quality }) { title: video.title.trim(), } + let subtitles; + if (subtitleLang && video.subtitles?.length) { + const subtitle = video.subtitles.find( + s => !s.is_auto && s.lang.startsWith(subtitleLang) + ); + if (subtitle) { + subtitles = subtitle.url; + fileMetadata.sublanguage = subtitleLang; + } + } + return { urls: url, + subtitles, fileMetadata, filenameAttributes: { service: "vk",