From 8dcc98b3b9d8e189a4c92ab0cbed7e3635341b5d Mon Sep 17 00:00:00 2001 From: DUOLabs333 Date: Mon, 16 Jan 2023 18:37:52 -0500 Subject: [PATCH] If videCountText lists the number of subscribers, then don't use it in get_video_count --- src/invidious/yt_backend/extractors.cr | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/invidious/yt_backend/extractors.cr b/src/invidious/yt_backend/extractors.cr index cd52c73b..d32f5646 100644 --- a/src/invidious/yt_backend/extractors.cr +++ b/src/invidious/yt_backend/extractors.cr @@ -652,8 +652,13 @@ module HelperExtractors # # Returns a 0 when it's unable to do so def self.get_video_count(container : JSON::Any) : Int32 + puts container if box = container["videoCountText"]? - return extract_text(box).try &.gsub(/\D/, "").to_i || 0 + if (extracted_text = extract_text(box)) && !extracted_text.includes? " subscriber" + return extracted_text.gsub(/\D/, "").to_i + else + return 0 + end elsif box = container["videoCount"]? return box.as_s.to_i else