aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor/streamcz.py
diff options
context:
space:
mode:
authorPetr Vaněk <arkamar@atlas.cz>2022-02-12 12:28:30 +0100
committerdirkf <fieldhouse@gmx.net>2022-02-14 07:07:05 +0000
commitb1297308fb7b423a60c3a28c74ac014d7b385a2a (patch)
tree0548ec75c2910cd1fa8609f4b400f5eff5ce3779 /youtube_dl/extractor/streamcz.py
parent8088ce036ac4ce282f8f864c6b5f4f3987647221 (diff)
downloadyoutube-dl-b1297308fb7b423a60c3a28c74ac014d7b385a2a.tar.xz
avoid traverse_obj function
Diffstat (limited to 'youtube_dl/extractor/streamcz.py')
-rw-r--r--youtube_dl/extractor/streamcz.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/youtube_dl/extractor/streamcz.py b/youtube_dl/extractor/streamcz.py
index 998342e93..fbdc44505 100644
--- a/youtube_dl/extractor/streamcz.py
+++ b/youtube_dl/extractor/streamcz.py
@@ -7,7 +7,6 @@ from ..utils import (
float_or_none,
int_or_none,
parse_codecs,
- traverse_obj,
urljoin,
)
@@ -38,7 +37,7 @@ class StreamCZIE(InfoExtractor):
def _extract_formats(self, spl_url, video):
for ext, pref, streams in (
- ('ts', -1, traverse_obj(video, ('http_stream', 'qualities'))),
+ ('ts', -1, video.get('http_stream', {}).get('qualities', {})),
('mp4', 1, video.get('mp4'))):
for format_id, stream in streams.items():
if not stream.get('url'):
@@ -50,8 +49,8 @@ class StreamCZIE(InfoExtractor):
'url': urljoin(spl_url, stream['url']),
'tbr': float_or_none(stream.get('bandwidth'), scale=1000),
'duration': float_or_none(stream.get('duration'), scale=1000),
- 'width': traverse_obj(stream, ('resolution', 0)),
- 'height': traverse_obj(stream, ('resolution', 1)) or int_or_none(format_id.replace('p', '')),
+ 'width': stream.get('resolution', 2 * [0])[0] or None,
+ 'height': stream.get('resolution', 2 * [0])[1] or int_or_none(format_id.replace('p', '')),
**parse_codecs(stream.get('codec')),
}