mirror of
https://github.com/iv-org/invidious.git
synced 2025-07-29 08:48:30 +00:00
Workaround: Make invidious use HTML5 innertube client if the Android client fails
This commit is contained in:
parent
99a5e9cbc4
commit
1e338a51c8
@ -102,16 +102,24 @@ def extract_video_info(video_id : String, proxy_region : String? = nil)
|
|||||||
|
|
||||||
new_player_response = nil
|
new_player_response = nil
|
||||||
|
|
||||||
if reason.nil?
|
begin
|
||||||
# Fetch the video streams using an Android client in order to get the
|
if reason.nil?
|
||||||
# decrypted URLs and maybe fix throttling issues (#2194). See the
|
# Fetch the video streams using an Android client in order to get the
|
||||||
# following issue for an explanation about decrypted URLs:
|
# decrypted URLs and maybe fix throttling issues (#2194). See the
|
||||||
# https://github.com/TeamNewPipe/NewPipeExtractor/issues/562
|
# following issue for an explanation about decrypted URLs:
|
||||||
client_config.client_type = YoutubeAPI::ClientType::Android
|
# https://github.com/TeamNewPipe/NewPipeExtractor/issues/562
|
||||||
new_player_response = try_fetch_streaming_data(video_id, client_config)
|
client_config.client_type = YoutubeAPI::ClientType::Android
|
||||||
elsif !reason.includes?("your country") # Handled separately
|
new_player_response = try_fetch_streaming_data(video_id, client_config)
|
||||||
# The Android embedded client could help here
|
elsif !reason.includes?("your country") # Handled separately
|
||||||
client_config.client_type = YoutubeAPI::ClientType::AndroidScreenEmbed
|
# The Android embedded client could help here
|
||||||
|
client_config.client_type = YoutubeAPI::ClientType::AndroidScreenEmbed
|
||||||
|
new_player_response = try_fetch_streaming_data(video_id, client_config)
|
||||||
|
end
|
||||||
|
rescue VideoNotAvailableException
|
||||||
|
# YouTube returns the "Video Not Available" video data instead of the
|
||||||
|
# video itself, but not on HTML5
|
||||||
|
Log.warn { "YouTube's Android client did not return the video we were looking for, Falling back on HTML5 client" }
|
||||||
|
client_config.client_type = YoutubeAPI::ClientType::TvHtml5ScreenEmbed
|
||||||
new_player_response = try_fetch_streaming_data(video_id, client_config)
|
new_player_response = try_fetch_streaming_data(video_id, client_config)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user