mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-11 07:10:30 +00:00
[twitch] Make more robust
This commit is contained in:
parent
369c12e038
commit
7a6e8a1b17
@ -15,6 +15,7 @@
|
|||||||
)
|
)
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
ExtractorError,
|
ExtractorError,
|
||||||
|
int_or_none,
|
||||||
parse_duration,
|
parse_duration,
|
||||||
parse_iso8601,
|
parse_iso8601,
|
||||||
)
|
)
|
||||||
@ -133,13 +134,13 @@ def _extract_info(self, info):
|
|||||||
return {
|
return {
|
||||||
'id': info['_id'],
|
'id': info['_id'],
|
||||||
'title': info.get('title') or 'Untitled Broadcast',
|
'title': info.get('title') or 'Untitled Broadcast',
|
||||||
'description': info['description'],
|
'description': info.get('description'),
|
||||||
'duration': info['length'],
|
'duration': int_or_none(info.get('length')),
|
||||||
'thumbnail': info['preview'],
|
'thumbnail': info.get('preview'),
|
||||||
'uploader': info['channel']['display_name'],
|
'uploader': info.get('channel', {}).get('display_name'),
|
||||||
'uploader_id': info['channel']['name'],
|
'uploader_id': info.get('channel', {}).get('name'),
|
||||||
'timestamp': parse_iso8601(info['recorded_at']),
|
'timestamp': parse_iso8601(info.get('recorded_at')),
|
||||||
'view_count': info['views'],
|
'view_count': int_or_none(info.get('views')),
|
||||||
}
|
}
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
|
Loading…
Reference in New Issue
Block a user