diff options
| author | Samantaz Fox <coding@samantaz.fr> | 2022-06-23 21:32:02 +0200 |
|---|---|---|
| committer | Samantaz Fox <coding@samantaz.fr> | 2022-07-04 22:24:36 +0200 |
| commit | f7b1dcc271bb14bf8962c9375c413c0cf01d880b (patch) | |
| tree | b5f542ac5a4f829261c77761b2f593eabdb54955 /src | |
| parent | eb226e1dcf4ca88776aa42402e8d80fd5f14ae96 (diff) | |
| download | invidious-f7b1dcc271bb14bf8962c9375c413c0cf01d880b.tar.gz invidious-f7b1dcc271bb14bf8962c9375c413c0cf01d880b.tar.bz2 invidious-f7b1dcc271bb14bf8962c9375c413c0cf01d880b.zip | |
Don't treat LIVE_STREAM_OFFLINE playability status as an error (fixes #3155)
Diffstat (limited to 'src')
| -rw-r--r-- | src/invidious/videos.cr | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/invidious/videos.cr b/src/invidious/videos.cr index 3204c98d..d9a7d846 100644 --- a/src/invidious/videos.cr +++ b/src/invidious/videos.cr @@ -895,13 +895,20 @@ def extract_video_info(video_id : String, proxy_region : String? = nil, context_ player_response = YoutubeAPI.player(video_id: video_id, params: "", client_config: client_config) - if player_response.dig?("playabilityStatus", "status").try &.as_s != "OK" + playability_status = player_response.dig?("playabilityStatus", "status").try &.as_s + + if playability_status != "OK" subreason = player_response.dig?("playabilityStatus", "errorScreen", "playerErrorMessageRenderer", "subreason") reason = subreason.try &.[]?("simpleText").try &.as_s reason ||= subreason.try &.[]("runs").as_a.map(&.[]("text")).join("") reason ||= player_response.dig("playabilityStatus", "reason").as_s + params["reason"] = JSON::Any.new(reason) - return params + + # Stop here if video is not a scheduled livestream + if playability_status != "LIVE_STREAM_OFFLINE" + return params + end end params["shortDescription"] = player_response.dig?("videoDetails", "shortDescription") || JSON::Any.new(nil) |
