mirror of
https://github.com/yattee/yattee.git
synced 2025-12-16 21:18:16 +00:00
Fix Invidious captions URL when companion is enabled
Prefix caption URLs with /companion when invidiousCompanion is enabled in instance settings. This ensures captions are routed through the companion service, matching the behavior of video streams.
This commit is contained in:
@@ -858,7 +858,14 @@ final class InvidiousAPI: Service, ObservableObject, VideosAPI {
|
|||||||
|
|
||||||
private func extractCaptions(from content: JSON) -> [Captions] {
|
private func extractCaptions(from content: JSON) -> [Captions] {
|
||||||
content["captions"].arrayValue.compactMap { details in
|
content["captions"].arrayValue.compactMap { details in
|
||||||
guard let url = URL(string: details["url"].stringValue, relativeTo: account.url) else { return nil }
|
var urlString = details["url"].stringValue
|
||||||
|
|
||||||
|
// Prefix with /companion if enabled
|
||||||
|
if account.instance.invidiousCompanion {
|
||||||
|
urlString = "/companion" + urlString
|
||||||
|
}
|
||||||
|
|
||||||
|
guard let url = URL(string: urlString, relativeTo: account.url) else { return nil }
|
||||||
|
|
||||||
return Captions(
|
return Captions(
|
||||||
label: details["label"].stringValue,
|
label: details["label"].stringValue,
|
||||||
|
|||||||
Reference in New Issue
Block a user