diff options
| author | Émilien Devos <contact@emiliendevos.be> | 2022-08-25 10:39:10 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-08-25 10:39:10 +0200 |
| commit | a7d9df551675169014a3a9481f9a3871f055d9db (patch) | |
| tree | b029ad6e850e1f98bb41e2b4c0d0ff6caa801664 /src | |
| parent | 16b23efb4fc7d566831125ae5bacf5b52c7d8fb7 (diff) | |
| download | invidious-a7d9df551675169014a3a9481f9a3871f055d9db.tar.gz invidious-a7d9df551675169014a3a9481f9a3871f055d9db.tar.bz2 invidious-a7d9df551675169014a3a9481f9a3871f055d9db.zip | |
add check video id for android client too (#3280)
Diffstat (limited to 'src')
| -rw-r--r-- | src/invidious/videos.cr | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/invidious/videos.cr b/src/invidious/videos.cr index 5ed57727..c0ed6e85 100644 --- a/src/invidious/videos.cr +++ b/src/invidious/videos.cr @@ -912,7 +912,7 @@ def extract_video_info(video_id : String, proxy_region : String? = nil, context_ elsif video_id != player_response.dig("videoDetails", "videoId") # YouTube may return a different video player response than expected. # See: https://github.com/TeamNewPipe/NewPipe/issues/8713 - raise VideoNotAvailableException.new("The video returned by YouTube isn't the requested one.") + raise VideoNotAvailableException.new("The video returned by YouTube isn't the requested one. (WEB client)") else reason = nil end @@ -937,10 +937,14 @@ def extract_video_info(video_id : String, proxy_region : String? = nil, context_ end android_player = YoutubeAPI.player(video_id: video_id, params: "", client_config: client_config) - # Sometime, the video is available from the web client, but not on Android, so check + # Sometimes, 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" + if video_id != android_player.dig("videoDetails", "videoId") + # YouTube may return a different video player response than expected. + # See: https://github.com/TeamNewPipe/NewPipe/issues/8713 + raise VideoNotAvailableException.new("The video returned by YouTube isn't the requested one. (ANDROID client)") + elsif android_player["playabilityStatus"]["status"] == "OK" params["streamingData"] = android_player["streamingData"]? || JSON::Any.new("") else params["streamingData"] = player_response["streamingData"]? || JSON::Any.new("") |
