From ad1f8df7cb9fb8f11e8b1d632730f27c524f54ec Mon Sep 17 00:00:00 2001 From: Cadence Ember Date: Thu, 15 Oct 2020 00:32:06 +1300 Subject: [PATCH] Correctly handle videos with 0 views --- tools/converters.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/converters.py b/tools/converters.py index 84e49ce..c5875c6 100644 --- a/tools/converters.py +++ b/tools/converters.py @@ -44,7 +44,11 @@ def add_html_links(text): return text def view_count_text_to_number(text): - return int(text.split(" ")[0].replace(",", "")) + first_word = text.split(" ")[0].replace(",", "") + if first_word == "No": + return 0 + else: + return int(first_word) def get_view_count_or_recommended(view_count_container): text = view_count_container.get("viewCountText") or view_count_container["viewCount"]