1
0
mirror of https://github.com/yt-dlp/yt-dlp synced 2025-07-04 04:52:52 -05:00

Handle negative duration from extractor

Closes #2921
This commit is contained in:
pukkandan
2022-03-04 19:40:10 +05:30
parent 7265a2190c
commit 4c3f8c3fb6
2 changed files with 3 additions and 1 deletions

View File

@ -2257,7 +2257,7 @@ def unsmuggle_url(smug_url, default=None):
def format_decimal_suffix(num, fmt='%d%s', *, factor=1000):
""" Formats numbers with decimal sufixes like K, M, etc """
num, factor = float_or_none(num), float(factor)
if num is None:
if num is None or num < 0:
return None
exponent = 0 if num == 0 else int(math.log(num, factor))
suffix = ['', *'kMGTPEZY'][exponent]