aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor/twitch.py
diff options
context:
space:
mode:
authorJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>2015-02-17 18:55:53 +0100
committerJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>2015-02-17 18:57:01 +0100
commit4cd95bcbc34d74e506e6158251d50d83697da5fe (patch)
treee88fe2371a20b0fab65ed49c74f7dcfd6408b2e4 /youtube_dl/extractor/twitch.py
parentbe24c8697f51fbc68e2cd99668e675a07a3735de (diff)
[twitch:stream] Prefer the 'source' format (fixes #4972)
Diffstat (limited to 'youtube_dl/extractor/twitch.py')
-rw-r--r--youtube_dl/extractor/twitch.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/youtube_dl/extractor/twitch.py b/youtube_dl/extractor/twitch.py
index 87290d002..8e296698e 100644
--- a/youtube_dl/extractor/twitch.py
+++ b/youtube_dl/extractor/twitch.py
@@ -348,6 +348,12 @@ class TwitchStreamIE(TwitchBaseIE):
'%s/api/channel/hls/%s.m3u8?%s'
% (self._USHER_BASE, channel_id, compat_urllib_parse.urlencode(query).encode('utf-8')),
channel_id, 'mp4')
+ # prefer the 'source' stream, the others are limited to 30 fps
+ def _sort_source(f):
+ if f.get('m3u8_media') is not None and f['m3u8_media'].get('NAME') == 'Source':
+ return 1
+ return 0
+ formats = sorted(formats, key=_sort_source)
view_count = stream.get('viewers')
timestamp = parse_iso8601(stream.get('created_at'))