diff options
author | pukkandan <pukkandan.ytdlp@gmail.com> | 2022-05-07 19:45:00 +0530 |
---|---|---|
committer | pukkandan <pukkandan.ytdlp@gmail.com> | 2022-05-07 19:45:33 +0530 |
commit | d4736fdb43be5f0e3050e831b8d8d73e815ba98d (patch) | |
tree | 5e7ca76b5247ed2f8fddcc81344e42e43f076bf8 | |
parent | 895aeb71d794227a24c93b39449a0f6bab068c21 (diff) | |
download | hypervideo-pre-d4736fdb43be5f0e3050e831b8d8d73e815ba98d.tar.lz hypervideo-pre-d4736fdb43be5f0e3050e831b8d8d73e815ba98d.tar.xz hypervideo-pre-d4736fdb43be5f0e3050e831b8d8d73e815ba98d.zip |
Remove warning for videos with an empty title
-rw-r--r-- | yt_dlp/YoutubeDL.py | 12 | ||||
-rw-r--r-- | yt_dlp/extractor/common.py | 4 |
2 files changed, 11 insertions, 5 deletions
diff --git a/yt_dlp/YoutubeDL.py b/yt_dlp/YoutubeDL.py index 1766ff379..3946311cd 100644 --- a/yt_dlp/YoutubeDL.py +++ b/yt_dlp/YoutubeDL.py @@ -2335,12 +2335,16 @@ class YoutubeDL: # 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: diff --git a/yt_dlp/extractor/common.py b/yt_dlp/extractor/common.py index 97cd524bc..e5a44e296 100644 --- a/yt_dlp/extractor/common.py +++ b/yt_dlp/extractor/common.py @@ -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: |