Attempt to fix playback errors
All checks were successful
Invidious CI / build (push) Successful in 5m11s

This commit is contained in:
Samantaz Fox 2024-10-11 17:08:27 +02:00
parent 46041f5b60
commit 2f3266cd01
No known key found for this signature in database
GPG key ID: F42821059186176E

View file

@ -74,7 +74,10 @@ def extract_video_info(video_id : String, *, level = 0, client_type = YoutubeAPI
reason ||= subreason.try &.[]("runs").as_a.map(&.[]("text")).join("")
reason ||= player_response.dig("playabilityStatus", "reason").as_s
if playability_status == "UNPLAYABLE" && reason.includes?("Get the YouTube app")
# Show the playability status in the reason message
reason = "#{reason} (#{playability_status})"
if (playability_status == "UNPLAYABLE" && reason.includes?("Get the YouTube app")) || reason.includes?("protect our community")
return extract_video_info(video_id: video_id, level: level, client_type: YoutubeAPI::ClientType::IOS)
elsif !{"LIVE_STREAM_OFFLINE", "LOGIN_REQUIRED"}.any?(playability_status) ||
playability_status == "LOGIN_REQUIRED" && !player_response.dig?("videoDetails")