diff options
author | pukkandan <pukkandan.ytdlp@gmail.com> | 2021-07-21 20:44:18 +0530 |
---|---|---|
committer | pukkandan <pukkandan.ytdlp@gmail.com> | 2021-07-21 20:50:58 +0530 |
commit | ae30b84072803f549a88c7fb0202bee10cdc34ab (patch) | |
tree | ad26378087068b01b4080dd83cebbbbc8797788f /yt_dlp/YoutubeDL.py | |
parent | cc9d1493c6ec20f9401356f973c1a42e6d11895d (diff) | |
download | hypervideo-pre-ae30b84072803f549a88c7fb0202bee10cdc34ab.tar.lz hypervideo-pre-ae30b84072803f549a88c7fb0202bee10cdc34ab.tar.xz hypervideo-pre-ae30b84072803f549a88c7fb0202bee10cdc34ab.zip |
Add field `live_status`
Diffstat (limited to 'yt_dlp/YoutubeDL.py')
-rw-r--r-- | yt_dlp/YoutubeDL.py | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/yt_dlp/YoutubeDL.py b/yt_dlp/YoutubeDL.py index 1789cb463..3ab59ea31 100644 --- a/yt_dlp/YoutubeDL.py +++ b/yt_dlp/YoutubeDL.py @@ -2036,7 +2036,7 @@ class YoutubeDL(object): elif thumbnails: info_dict['thumbnail'] = thumbnails[-1]['url'] - if 'display_id' not in info_dict and 'id' in info_dict: + if info_dict.get('display_id') is None and 'id' in info_dict: info_dict['display_id'] = info_dict['id'] for ts_key, date_key in ( @@ -2052,6 +2052,23 @@ class YoutubeDL(object): except (ValueError, OverflowError, OSError): pass + live_keys = ('is_live', 'was_live') + live_status = info_dict.get('live_status') + if live_status is None: + for key in live_keys: + if info_dict.get(key) is False: + continue + if info_dict.get(key): + live_status = key + break + if all(info_dict.get(key) is False for key in live_keys): + live_status = 'not_live' + if live_status: + info_dict['live_status'] = live_status + for key in live_keys: + if info_dict.get(key) is None: + info_dict[key] = (live_status == key) + # Auto generate title fields corresponding to the *_number fields when missing # in order to always have clean titles. This is very common for TV series. for field in ('chapter', 'season', 'episode'): |