未验证 提交 d4736fdb 编写于 作者: P pukkandan

Remove warning for videos with an empty title

上级 895aeb71
...@@ -2335,11 +2335,15 @@ def _fill_common_fields(self, info_dict, is_video=True): ...@@ -2335,11 +2335,15 @@ def _fill_common_fields(self, info_dict, is_video=True):
# TODO: move sanitization here # TODO: move sanitization here
if is_video: if is_video:
# playlists are allowed to lack "title" # playlists are allowed to lack "title"
info_dict['fulltitle'] = info_dict.get('title') title = info_dict.get('title', NO_DEFAULT)
if 'title' not in info_dict: if title is NO_DEFAULT:
raise ExtractorError('Missing "title" field in extractor result', raise ExtractorError('Missing "title" field in extractor result',
video_id=info_dict['id'], ie=info_dict['extractor']) video_id=info_dict['id'], ie=info_dict['extractor'])
elif not info_dict.get('title'): 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') 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"]}' info_dict['title'] = f'{info_dict["extractor"].replace(":", "-")} video #{info_dict["id"]}'
......
...@@ -103,7 +103,9 @@ class InfoExtractor: ...@@ -103,7 +103,9 @@ class InfoExtractor:
For a video, the dictionaries must include the following fields: For a video, the dictionaries must include the following fields:
id: Video identifier. 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: Additionally, it must contain either a formats entry or a url one:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册