Created
November 18, 2019 14:12
-
-
Save palevell/add67ace898d7381c6e79b5d8fa56a69 to your computer and use it in GitHub Desktop.
this is a patch to fix 'Cannot write' errors related to long tweets
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/youtube_dl/extractor/twitter.py b/youtube_dl/extractor/twitter.py | |
index 5f8d90fb4..3cf8e408b 100644 | |
--- a/youtube_dl/extractor/twitter.py | |
+++ b/youtube_dl/extractor/twitter.py | |
@@ -392,6 +392,10 @@ class TwitterIE(TwitterBaseIE): | |
title = description = status['full_text'].replace('\n', ' ') | |
# strip 'https -_t.co_BJYgOjSeGA' junk from filenames | |
title = re.sub(r'\s+(https?://[^ ]+)', '', title) | |
+ # 2019-Nov-18 PAL - BEGIN Truncate long tweets to prevent 'Cannot write' errors | |
+ if len(title) > 200: | |
+ title = title[:200] + '...' | |
+ # 2019-Nov-18 PAL - END | |
user = status.get('user') or {} | |
uploader = user.get('name') | |
if uploader: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment