Update youtube_dl/extractor/twitter.py

Co-authored-by: dirkf <fieldhouse@gmx.net>
This commit is contained in:
Ben Welsh 2022-08-10 05:25:40 -07:00 committed by GitHub
parent c1c8791335
commit 9b6e3940a7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -466,7 +466,12 @@ class TwitterIE(TwitterBaseIE):
# Keep the file name short so it doesn't exceed filesystem limits
title = description
if len(title) > 40:
title = title[:35] + "[...]"
trim = 35
# allow up to 10 more characters to find whitespace
m = re.search(r'\s+', title, trim, trim + 10)
if m:
trim = m.start() + 1
title = title[:trim] + '...'
if uploader:
title = '%s - %s' % (uploader, title)