1
0
Fork 0
mirror of https://git.sr.ht/~cadence/NewLeaf synced 2026-05-04 16:41:37 +00:00

Support lockupViewModel in channel extractor

This commit is contained in:
Eleanor Clifford 2026-04-30 17:59:20 +01:00 committed by Cadence Ember
parent fde9f3272a
commit 07fa3fffd6
2 changed files with 75 additions and 22 deletions

View file

@ -48,10 +48,19 @@ def view_count_text_to_number(text):
if text is None:
return 0
suffixes = {
"K": 1000,
"M": 1000000,
"B": 1000000000,
}
first_word = text.split(" ")[0].replace(",", "")
if first_word == "No":
return 0
else:
for s in suffixes:
if first_word.endswith(s):
return int(suffixes[s] * float(first_word[:-1]))
return int(first_word)
def get_view_count_or_recommended(view_count_container):