Attempt to fix playback errors
All checks were successful
Invidious CI / build (push) Successful in 5m11s
All checks were successful
Invidious CI / build (push) Successful in 5m11s
This commit is contained in:
parent
46041f5b60
commit
2f3266cd01
1 changed files with 9 additions and 6 deletions
|
@ -54,11 +54,11 @@ def extract_video_info(video_id : String, *, level = 0, client_type = YoutubeAPI
|
||||||
# Infinite recursion prevention
|
# Infinite recursion prevention
|
||||||
level += 1
|
level += 1
|
||||||
if level >= 3
|
if level >= 3
|
||||||
return {
|
return {
|
||||||
"version" => JSON::Any.new(Video::SCHEMA_VERSION.to_i64),
|
"version" => JSON::Any.new(Video::SCHEMA_VERSION.to_i64),
|
||||||
"reason" => JSON::Any.new("All counter-measures exhausted"),
|
"reason" => JSON::Any.new("All counter-measures exhausted"),
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
# Init client config for the API
|
# Init client config for the API
|
||||||
client_config = YoutubeAPI::ClientConfig.new
|
client_config = YoutubeAPI::ClientConfig.new
|
||||||
|
@ -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 ||= subreason.try &.[]("runs").as_a.map(&.[]("text")).join("")
|
||||||
reason ||= player_response.dig("playabilityStatus", "reason").as_s
|
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)
|
return extract_video_info(video_id: video_id, level: level, client_type: YoutubeAPI::ClientType::IOS)
|
||||||
elsif !{"LIVE_STREAM_OFFLINE", "LOGIN_REQUIRED"}.any?(playability_status) ||
|
elsif !{"LIVE_STREAM_OFFLINE", "LOGIN_REQUIRED"}.any?(playability_status) ||
|
||||||
playability_status == "LOGIN_REQUIRED" && !player_response.dig?("videoDetails")
|
playability_status == "LOGIN_REQUIRED" && !player_response.dig?("videoDetails")
|
||||||
|
|
Loading…
Reference in a new issue