diff options
author | DEvmIb <DEvmIb@users.noreply.github.com> | 2021-11-27 19:25:18 +0530 |
---|---|---|
committer | pukkandan <pukkandan.ytdlp@gmail.com> | 2021-11-27 19:25:24 +0530 |
commit | a33c0d9c5d6b58b9dc5c0c3adcf4407b64f8b56d (patch) | |
tree | 2a3bd52b4e08751d8e5e7725738e02578d81e519 | |
parent | 75689fe59bee583d2e381fa9f9416c3f53c6be53 (diff) | |
download | hypervideo-pre-a33c0d9c5d6b58b9dc5c0c3adcf4407b64f8b56d.tar.lz hypervideo-pre-a33c0d9c5d6b58b9dc5c0c3adcf4407b64f8b56d.tar.xz hypervideo-pre-a33c0d9c5d6b58b9dc5c0c3adcf4407b64f8b56d.zip |
[twitch:vod] Extract live status (#1722)
Authored by: DEvmIb
-rw-r--r-- | yt_dlp/extractor/twitch.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/yt_dlp/extractor/twitch.py b/yt_dlp/extractor/twitch.py index c5b16f2b0..cd97f0a24 100644 --- a/yt_dlp/extractor/twitch.py +++ b/yt_dlp/extractor/twitch.py @@ -345,6 +345,7 @@ class TwitchVodIE(TwitchBaseIE): 'timestamp': parse_iso8601(info.get('recorded_at')), 'view_count': int_or_none(info.get('views')), 'is_live': is_live, + 'was_live': True, } def _extract_moments(self, info, item_id): @@ -368,9 +369,14 @@ class TwitchVodIE(TwitchBaseIE): if vod_id[0] != 'v': vod_id = 'v%s' % vod_id thumbnail = url_or_none(info.get('previewThumbnailURL')) + is_live = None if thumbnail: - for p in ('width', 'height'): - thumbnail = thumbnail.replace('{%s}' % p, '0') + if thumbnail.endswith('/404_processing_{width}x{height}.png'): + is_live, thumbnail = True, None + else: + is_live = False + for p in ('width', 'height'): + thumbnail = thumbnail.replace('{%s}' % p, '0') return { 'id': vod_id, @@ -383,6 +389,8 @@ class TwitchVodIE(TwitchBaseIE): 'timestamp': unified_timestamp(info.get('publishedAt')), 'view_count': int_or_none(info.get('viewCount')), 'chapters': list(self._extract_moments(info, item_id)), + 'is_live': is_live, + 'was_live': True, } def _real_extract(self, url): |