Skip to content

Instantly share code, notes, and snippets.

@palevell
Created January 14, 2020 15:33
Show Gist options
  • Save palevell/c9781f75ca482ab406514d068ad3e639 to your computer and use it in GitHub Desktop.
Save palevell/c9781f75ca482ab406514d068ad3e639 to your computer and use it in GitHub Desktop.
This patch fixes 'Filename too long' errors when video titles are too long for the filesystem.
*** /usr/local/lib/python3.8/site-packages/youtube_dl/YoutubeDL.py 2020-01-14 08:51:17.908524990 -0500
--- youtube_dl/YoutubeDL.py 2020-01-14 09:06:18.785934554 -0500
***************
*** 635,640 ****
--- 635,646 ----
try:
template_dict = dict(info_dict)
+ ##### 2020-Jan-13 PAL - Fix 'Filename too long errors' - BEGIN
+ if 'title' in template_dict.keys():
+ if len(template_dict['title']) > 200:
+ template_dict['title'] = template_dict['title'][:200].strip() + '_'
+ ##### END
+
template_dict['epoch'] = int(time.time())
autonumber_size = self.params.get('autonumber_size')
if autonumber_size is None:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment