1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-10-04 22:37:56 -04:00

[jsinterp] Truncate error messages

Related: #4635
This commit is contained in:
pukkandan
2022-08-12 18:53:53 +05:30
parent 5da42f2b9b
commit a1c5bd82ec
2 changed files with 26 additions and 15 deletions

View File

@@ -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)