mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-30 12:01:28 +00:00
Remove warning for videos with an empty title
This commit is contained in:
parent
895aeb71d7
commit
d4736fdb43
|
@ -2335,12 +2335,16 @@ def _fill_common_fields(self, info_dict, is_video=True):
|
|||
# TODO: move sanitization here
|
||||
if is_video:
|
||||
# playlists are allowed to lack "title"
|
||||
info_dict['fulltitle'] = info_dict.get('title')
|
||||
if 'title' not in info_dict:
|
||||
title = info_dict.get('title', NO_DEFAULT)
|
||||
if title is NO_DEFAULT:
|
||||
raise ExtractorError('Missing "title" field in extractor result',
|
||||
video_id=info_dict['id'], ie=info_dict['extractor'])
|
||||
elif not info_dict.get('title'):
|
||||
self.report_warning('Extractor failed to obtain "title". Creating a generic title instead')
|
||||
info_dict['fulltitle'] = title
|
||||
if not title:
|
||||
if title == '':
|
||||
self.write_debug('Extractor gave empty title. Creating a generic title')
|
||||
else:
|
||||
self.report_warning('Extractor failed to obtain "title". Creating a generic title instead')
|
||||
info_dict['title'] = f'{info_dict["extractor"].replace(":", "-")} video #{info_dict["id"]}'
|
||||
|
||||
if info_dict.get('duration') is not None:
|
||||
|
|
|
@ -103,7 +103,9 @@ class InfoExtractor:
|
|||
For a video, the dictionaries must include the following fields:
|
||||
|
||||
id: Video identifier.
|
||||
title: Video title, unescaped.
|
||||
title: Video title, unescaped. Set to an empty string if video has
|
||||
no title as opposed to "None" which signifies that the
|
||||
extractor failed to obtain a title
|
||||
|
||||
Additionally, it must contain either a formats entry or a url one:
|
||||
|
||||
|
|
Loading…
Reference in a new issue