mirror of
https://github.com/nimbold/Firelink.git
synced 2026-08-27 19:17:13 +00:00
perf(media): optimize yt-dlp extraction speed and fix proxy propagation
- Add '--extractor-args youtube:player_client=ios,web' to bypass heavy JS challenge solving - Add '--compat-options no-youtube-unavailable-videos' to skip blocked videos - Fix missing proxy configuration in MediaExtractionEngine that caused timeouts - Add '--live-from-start' for yt-dlp to handle live streams correctly
This commit is contained in:
@@ -603,7 +603,8 @@ struct AddDownloadsView: View {
|
|||||||
for: item.url,
|
for: item.url,
|
||||||
cookieSource: settings.mediaCookieSource,
|
cookieSource: settings.mediaCookieSource,
|
||||||
credentials: metadataCredentials(for: item.url),
|
credentials: metadataCredentials(for: item.url),
|
||||||
transferOptions: transferOptions
|
transferOptions: transferOptions,
|
||||||
|
proxyConfiguration: settings.downloadProxyConfiguration
|
||||||
)
|
)
|
||||||
fetchedItem.mediaMetadata = metadata
|
fetchedItem.mediaMetadata = metadata
|
||||||
fetchedItem.mediaOptions = options
|
fetchedItem.mediaOptions = options
|
||||||
|
|||||||
@@ -45,6 +45,9 @@ final class MediaDownloadEngine: @unchecked Sendable {
|
|||||||
"--newline",
|
"--newline",
|
||||||
"--ffmpeg-location", ffmpegURL.path,
|
"--ffmpeg-location", ffmpegURL.path,
|
||||||
"--force-ipv4",
|
"--force-ipv4",
|
||||||
|
"--live-from-start",
|
||||||
|
"--extractor-args", "youtube:player_client=ios,web",
|
||||||
|
"--compat-options", "no-youtube-unavailable-videos",
|
||||||
"-o", item.destinationPath
|
"-o", item.destinationPath
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
@@ -69,7 +69,8 @@ enum MediaExtractionEngine {
|
|||||||
for url: URL,
|
for url: URL,
|
||||||
cookieSource: BrowserCookieSource,
|
cookieSource: BrowserCookieSource,
|
||||||
credentials: DownloadCredentials?,
|
credentials: DownloadCredentials?,
|
||||||
transferOptions: DownloadTransferOptions
|
transferOptions: DownloadTransferOptions,
|
||||||
|
proxyConfiguration: DownloadProxyConfiguration
|
||||||
) async throws -> (MediaMetadata, [CleanFormatOption]) {
|
) async throws -> (MediaMetadata, [CleanFormatOption]) {
|
||||||
guard let ytDlpURL = await MediaEngineManager.shared.binaryPath(for: .ytDlp),
|
guard let ytDlpURL = await MediaEngineManager.shared.binaryPath(for: .ytDlp),
|
||||||
FileManager.default.isExecutableFile(atPath: ytDlpURL.path) else {
|
FileManager.default.isExecutableFile(atPath: ytDlpURL.path) else {
|
||||||
@@ -77,7 +78,20 @@ enum MediaExtractionEngine {
|
|||||||
}
|
}
|
||||||
let ytDlpPath = ytDlpURL.path
|
let ytDlpPath = ytDlpURL.path
|
||||||
|
|
||||||
var args = ["-J", "--no-warnings", "--ignore-no-formats-error", "--no-playlist", "--force-ipv4"]
|
var args = [
|
||||||
|
"-J",
|
||||||
|
"--no-warnings",
|
||||||
|
"--ignore-no-formats-error",
|
||||||
|
"--no-playlist",
|
||||||
|
"--force-ipv4",
|
||||||
|
"--extractor-args", "youtube:player_client=ios,web",
|
||||||
|
"--compat-options", "no-youtube-unavailable-videos"
|
||||||
|
]
|
||||||
|
|
||||||
|
if let proxyURI = proxyConfiguration.customProxyURI, proxyConfiguration.mode == .custom {
|
||||||
|
args.append(contentsOf: ["--proxy", proxyURI])
|
||||||
|
}
|
||||||
|
|
||||||
appendCommonArguments(to: &args, cookieSource: cookieSource, credentials: credentials, transferOptions: transferOptions)
|
appendCommonArguments(to: &args, cookieSource: cookieSource, credentials: credentials, transferOptions: transferOptions)
|
||||||
args.append(url.absoluteString)
|
args.append(url.absoluteString)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user