aboutsummaryrefslogtreecommitdiffstats
path: root/yt_dlp/utils.py
diff options
context:
space:
mode:
authorpukkandan <pukkandan.ytdlp@gmail.com>2022-08-12 18:53:53 +0530
committerpukkandan <pukkandan.ytdlp@gmail.com>2022-08-12 19:15:16 +0530
commita1c5bd82eccf36ed239d368b86ac46db236ff9b1 (patch)
treeff841e71ef92875f6276eab9599ed1fbca8512a1 /yt_dlp/utils.py
parent5da42f2b9b29e69cff8a2ea22d3cf9c586e470d6 (diff)
downloadhypervideo-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.py7
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)