mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2023-06-08.git
synced 2024-08-15 00:53:38 +00:00
extract_video_info: make sure that the Android player response is valid
This commit is contained in:
parent
12c219ee6c
commit
319587e2f1
1 changed files with 10 additions and 2 deletions
|
@ -857,8 +857,16 @@ def extract_video_info(video_id : String, proxy_region : String? = nil, context_
|
||||||
else
|
else
|
||||||
client_config.client_type = YoutubeAPI::ClientType::Android
|
client_config.client_type = YoutubeAPI::ClientType::Android
|
||||||
end
|
end
|
||||||
stream_data = YoutubeAPI.player(video_id: video_id, params: "", client_config: client_config)
|
android_player = YoutubeAPI.player(video_id: video_id, params: "", client_config: client_config)
|
||||||
params["streamingData"] = stream_data["streamingData"]? || JSON::Any.new("")
|
|
||||||
|
# Sometime, the video is available from the web client, but not on Android, so check
|
||||||
|
# that here, and fallback to the streaming data from the web client if needed.
|
||||||
|
# See: https://github.com/iv-org/invidious/issues/2549
|
||||||
|
if android_player["playabilityStatus"]["status"] == "OK"
|
||||||
|
params["streamingData"] = android_player["streamingData"]? || JSON::Any.new("")
|
||||||
|
else
|
||||||
|
params["streamingData"] = player_response["streamingData"]? || JSON::Any.new("")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
{"captions", "microformat", "playabilityStatus", "storyboards", "videoDetails"}.each do |f|
|
{"captions", "microformat", "playabilityStatus", "storyboards", "videoDetails"}.each do |f|
|
||||||
|
|
Loading…
Reference in a new issue