mirror of
https://git.sr.ht/~cadence/NewLeaf
synced 2024-12-22 13:06:59 +00:00
Correctly handle videos with 0 views
This commit is contained in:
parent
0b9874a4f4
commit
ad1f8df7cb
@ -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"]
|
||||
|
Loading…
Reference in New Issue
Block a user