diff --git a/README.md b/README.md index d957283..13345f0 100644 --- a/README.md +++ b/README.md @@ -104,6 +104,7 @@ Native playback supports the returned proxy configuration and HLS query/segment- - SDR output only; HDR is not supported. - No embedded or YouTube captions, manual audio-track selection, rotation or deinterlacing. External WebVTT subtitles are supported for resolved streams. - yt-dlp support does not guarantee playback: extraction must yield HTTP(S)/HLS media without download-only fragment assembly. Audio-only results with explicit codec metadata are unsupported. Private, age-restricted, region-blocked or sign-in-required videos may fail; browser cookies are not used. Rebuild and reinstall for bundled extractor updates. +- YouTube extraction uses IPv4 to avoid anti-bot failures on affected IPv6 routes. This does not bypass account or regional restrictions; other video sites retain their default network routing. - Seeking can be slow on long-GOP or unindexed media. Live streams cannot be sought, and expired stream URLs are not automatically refreshed. - Audio-device changes during playback are not handled. diff --git a/Sources/App/YouTubeResolver.swift b/Sources/App/YouTubeResolver.swift index dbec498..ea395b9 100644 --- a/Sources/App/YouTubeResolver.swift +++ b/Sources/App/YouTubeResolver.swift @@ -245,7 +245,7 @@ enum YouTubeResolver { environment["PATH"] = directories.joined(separator: ":") let transport = "[protocol~='^(https?|m3u8(_native)?)$']" let resolution = height.map { "[height=\($0)]" } ?? "[height<=?1080]" - let arguments = [ + var arguments = [ "--ignore-config", "--no-plugin-dirs", "--no-cache-dir", "--no-remote-components", "--no-playlist", "--simulate", "--skip-download", "--dump-single-json", "--no-progress", "--color", "never", "--no-check-formats", @@ -253,8 +253,12 @@ enum YouTubeResolver { "--socket-timeout", "20", "--extractor-retries", "0", "--retries", "0", "--format-sort", "res", "--format-sort-force", "--format", "bestvideo*[dynamic_range=?SDR]\(resolution)\(transport)+bestaudio\(transport)/best[dynamic_range=?SDR]\(resolution)\(transport)", - "--", webpageURL.absoluteString ] + if webpageURL.host == "www.youtube.com" { + arguments.append("--force-ipv4") + } + arguments.append("--") + arguments.append(webpageURL.absoluteString) let output = try await YouTubeExtraction(executable: executable, arguments: arguments, environment: environment).run() try Task.checkCancellation() if let error = dependencyError(String(decoding: output.stderr, as: UTF8.self).lowercased()) {