mirror of
https://github.com/l1ving/youtube-dl
synced 2024-12-21 20:32:52 +08:00
[twitch] Extract is_live according to status (closes #16259)
This commit is contained in:
parent
1cc47c6674
commit
0ff51adae6
@ -168,6 +168,13 @@ class TwitchItemBaseIE(TwitchBaseIE):
|
|||||||
return self.playlist_result(entries, info['id'], info['title'])
|
return self.playlist_result(entries, info['id'], info['title'])
|
||||||
|
|
||||||
def _extract_info(self, info):
|
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 {
|
return {
|
||||||
'id': info['_id'],
|
'id': info['_id'],
|
||||||
'title': info.get('title') or 'Untitled Broadcast',
|
'title': info.get('title') or 'Untitled Broadcast',
|
||||||
@ -178,6 +185,7 @@ class TwitchItemBaseIE(TwitchBaseIE):
|
|||||||
'uploader_id': info.get('channel', {}).get('name'),
|
'uploader_id': info.get('channel', {}).get('name'),
|
||||||
'timestamp': parse_iso8601(info.get('recorded_at')),
|
'timestamp': parse_iso8601(info.get('recorded_at')),
|
||||||
'view_count': int_or_none(info.get('views')),
|
'view_count': int_or_none(info.get('views')),
|
||||||
|
'is_live': is_live,
|
||||||
}
|
}
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
|
Loading…
Reference in New Issue
Block a user