mirror of
https://github.com/l1ving/youtube-dl
synced 2025-03-07 05:17:17 +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):
|
def _extract_info(self, info):
|
||||||
status = info.get('status')
|
status = info.get('status')
|
||||||
|
# avoid filesystem's 255 bytes limit on filelength
|
||||||
|
title = info.get('title', '').encode()[:210].decode(errors='ignore')
|
||||||
if status == 'recording':
|
if status == 'recording':
|
||||||
is_live = True
|
is_live = True
|
||||||
elif status == 'recorded':
|
elif status == 'recorded':
|
||||||
@ -188,7 +190,7 @@ class TwitchItemBaseIE(TwitchBaseIE):
|
|||||||
is_live = None
|
is_live = None
|
||||||
return {
|
return {
|
||||||
'id': info['_id'],
|
'id': info['_id'],
|
||||||
'title': info.get('title') or 'Untitled Broadcast',
|
'title': title or 'Untitled Broadcast',
|
||||||
'description': info.get('description'),
|
'description': info.get('description'),
|
||||||
'duration': int_or_none(info.get('length')),
|
'duration': int_or_none(info.get('length')),
|
||||||
'thumbnail': info.get('preview'),
|
'thumbnail': info.get('preview'),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user