mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-30 03:33:02 +00:00
parent
7265a2190c
commit
4c3f8c3fb6
2 changed files with 3 additions and 1 deletions
|
@ -2392,6 +2392,8 @@ def sanitize_numeric_fields(info):
|
||||||
|
|
||||||
sanitize_string_field(info_dict, 'id')
|
sanitize_string_field(info_dict, 'id')
|
||||||
sanitize_numeric_fields(info_dict)
|
sanitize_numeric_fields(info_dict)
|
||||||
|
if (info_dict.get('duration') or 0) <= 0 and info_dict.pop('duration', None):
|
||||||
|
self.report_warning('"duration" field is negative, there is an error in extractor')
|
||||||
|
|
||||||
if 'playlist' not in info_dict:
|
if 'playlist' not in info_dict:
|
||||||
# It isn't part of a playlist
|
# It isn't part of a playlist
|
||||||
|
|
|
@ -2257,7 +2257,7 @@ def unsmuggle_url(smug_url, default=None):
|
||||||
def format_decimal_suffix(num, fmt='%d%s', *, factor=1000):
|
def format_decimal_suffix(num, fmt='%d%s', *, factor=1000):
|
||||||
""" Formats numbers with decimal sufixes like K, M, etc """
|
""" Formats numbers with decimal sufixes like K, M, etc """
|
||||||
num, factor = float_or_none(num), float(factor)
|
num, factor = float_or_none(num), float(factor)
|
||||||
if num is None:
|
if num is None or num < 0:
|
||||||
return None
|
return None
|
||||||
exponent = 0 if num == 0 else int(math.log(num, factor))
|
exponent = 0 if num == 0 else int(math.log(num, factor))
|
||||||
suffix = ['', *'kMGTPEZY'][exponent]
|
suffix = ['', *'kMGTPEZY'][exponent]
|
||||||
|
|
Loading…
Reference in a new issue