diff options
author | pukkandan <pukkandan.ytdlp@gmail.com> | 2022-08-12 18:53:53 +0530 |
---|---|---|
committer | pukkandan <pukkandan.ytdlp@gmail.com> | 2022-08-12 19:15:16 +0530 |
commit | a1c5bd82eccf36ed239d368b86ac46db236ff9b1 (patch) | |
tree | ff841e71ef92875f6276eab9599ed1fbca8512a1 /yt_dlp/utils.py | |
parent | 5da42f2b9b29e69cff8a2ea22d3cf9c586e470d6 (diff) | |
download | hypervideo-pre-a1c5bd82eccf36ed239d368b86ac46db236ff9b1.tar.lz hypervideo-pre-a1c5bd82eccf36ed239d368b86ac46db236ff9b1.tar.xz hypervideo-pre-a1c5bd82eccf36ed239d368b86ac46db236ff9b1.zip |
[jsinterp] Truncate error messages
Related: #4635
Diffstat (limited to 'yt_dlp/utils.py')
-rw-r--r-- | yt_dlp/utils.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/yt_dlp/utils.py b/yt_dlp/utils.py index 3a33cad2e..17d6e7335 100644 --- a/yt_dlp/utils.py +++ b/yt_dlp/utils.py @@ -5759,6 +5759,13 @@ def make_archive_id(ie, video_id): return f'{ie_key.lower()} {video_id}' +def truncate_string(s, left, right=0): + assert left > 3 and right >= 0 + if s is None or len(s) <= left + right: + return s + return f'{s[:left-3]}...{s[-right:]}' + + # Deprecated has_certifi = bool(certifi) has_websockets = bool(websockets) |