mirror of
https://github.com/yattee/yattee.git
synced 2026-02-21 18:29:44 +00:00
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.
This commit is contained in:
@@ -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).
|
||||
|
||||
Reference in New Issue
Block a user