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:
parent
fde9f3272a
commit
07fa3fffd6
2 changed files with 75 additions and 22 deletions
|
|
@ -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):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue