From aa5f0a49f1f0786c833f3ca4fb4e5f86a15e9d0e Mon Sep 17 00:00:00 2001 From: syeopite Date: Fri, 1 Sep 2023 12:14:05 -0700 Subject: [PATCH] Count when YouTube returns wrong video as failure --- src/invidious/videos/parser.cr | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/invidious/videos/parser.cr b/src/invidious/videos/parser.cr index 06ff96b1..67d74559 100644 --- a/src/invidious/videos/parser.cr +++ b/src/invidious/videos/parser.cr @@ -78,6 +78,11 @@ def extract_video_info(video_id : String, proxy_region : String? = nil) # YouTube may return a different video player response than expected. # See: https://github.com/TeamNewPipe/NewPipe/issues/8713 # Line to be reverted if one day we solve the video not available issue. + + # Although technically not a call to /videoplayback the fact that YouTube is returning the + # wrong video means that we should count it as a failure. + get_playback_statistic().as(Hash(String, Int64 | Float64))["totalRequests"] += 1 + return { "version" => JSON::Any.new(Video::SCHEMA_VERSION.to_i64), "reason" => JSON::Any.new("Can't load the video on this Invidious instance. YouTube is currently trying to block Invidious instances. Click here for more info about the issue."),