From 5f304ceb5c067513516eac01dced883443581e5f Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Wed, 18 Feb 2026 20:59:12 +0100 Subject: [PATCH] Apply Invidious proxy rewriting to download streams Downloads were using direct YouTube CDN URLs even when proxiesVideos was enabled. Apply the same proxyStreamsIfNeeded used by the player to the download code path in ContentService. --- Yattee/Services/API/ContentService.swift | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Yattee/Services/API/ContentService.swift b/Yattee/Services/API/ContentService.swift index 6cefd4f9..47d9a059 100644 --- a/Yattee/Services/API/ContentService.swift +++ b/Yattee/Services/API/ContentService.swift @@ -254,16 +254,19 @@ actor ContentService: ContentServiceProtocol { if instance.type == .yatteeServer { return try await yatteeServerAPI(for: instance).proxyStreams(videoID: videoID, instance: instance) } - return try await streams(videoID: videoID, instance: instance) + let fetchedStreams = try await streams(videoID: videoID, instance: instance) + return await InvidiousAPI.proxyStreamsIfNeeded(fetchedStreams, instance: instance) } /// Fetches video details, proxy streams, captions, and storyboards (Yattee Server only). - /// For other backends, falls back to regular streams. + /// For other backends, applies Invidious proxy rewriting if enabled. func videoWithProxyStreamsAndCaptionsAndStoryboards(id: String, instance: Instance) async throws -> (video: Video, streams: [Stream], captions: [Caption], storyboards: [Storyboard]) { if instance.type == .yatteeServer { return try await yatteeServerAPI(for: instance).videoWithProxyStreamsAndCaptionsAndStoryboards(id: id, instance: instance) } - return try await videoWithStreamsAndCaptionsAndStoryboards(id: id, instance: instance) + var result = try await videoWithStreamsAndCaptionsAndStoryboards(id: id, instance: instance) + result.streams = await InvidiousAPI.proxyStreamsIfNeeded(result.streams, instance: instance) + return result } /// Fetches video details, streams, and captions in a single API call (Invidious and Yattee Server).