mirror of
https://github.com/l1ving/youtube-dl
synced 2025-03-07 05:27:18 +08:00
[twitch] Strip title to avoid download error #24575
Since we create filename from title, it's very easy to get following error: ERROR: unable to open for writing: [Errno 36] File name too long: ... This commit strips title to 210 bytes so we'll fit into FS's 255 bytes filesize limit.
This commit is contained in:
parent
049c0486bb
commit
274dd5e6f2
@ -180,6 +180,8 @@ class TwitchItemBaseIE(TwitchBaseIE):
|
||||
|
||||
def _extract_info(self, info):
|
||||
status = info.get('status')
|
||||
# avoid filesystem's 255 bytes limit on filelength
|
||||
title = info.get('title', '').encode()[:210].decode(errors='ignore')
|
||||
if status == 'recording':
|
||||
is_live = True
|
||||
elif status == 'recorded':
|
||||
@ -188,7 +190,7 @@ class TwitchItemBaseIE(TwitchBaseIE):
|
||||
is_live = None
|
||||
return {
|
||||
'id': info['_id'],
|
||||
'title': info.get('title') or 'Untitled Broadcast',
|
||||
'title': title or 'Untitled Broadcast',
|
||||
'description': info.get('description'),
|
||||
'duration': int_or_none(info.get('length')),
|
||||
'thumbnail': info.get('preview'),
|
||||
|
Loading…
x
Reference in New Issue
Block a user