1
0
mirror of https://github.com/ytdl-org/youtube-dl.git synced 2024-11-06 01:22:35 +00:00

[twitch] Extract is_live according to status (closes #16259)

This commit is contained in:
Sergey M․ 2018-04-24 23:53:01 +07:00
parent 1cc47c6674
commit 0ff51adae6
No known key found for this signature in database
GPG Key ID: 2C393E0F18A9236D

View File

@ -168,6 +168,13 @@ class TwitchItemBaseIE(TwitchBaseIE):
return self.playlist_result(entries, info['id'], info['title'])
def _extract_info(self, info):
status = info.get('status')
if status == 'recording':
is_live = True
elif status == 'recorded':
is_live = False
else:
is_live = None
return {
'id': info['_id'],
'title': info.get('title') or 'Untitled Broadcast',
@ -178,6 +185,7 @@ class TwitchItemBaseIE(TwitchBaseIE):
'uploader_id': info.get('channel', {}).get('name'),
'timestamp': parse_iso8601(info.get('recorded_at')),
'view_count': int_or_none(info.get('views')),
'is_live': is_live,
}
def _real_extract(self, url):