X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;ds=sidebyside;f=youtube_dl%2Fextractor%2Ftwitch.py;h=4b0d8988d9cc0f866120d7f31a6facc25d47afec;hb=5c8a3f862a325987a9ddbdc7f08ea62aad80278e;hp=741df7cbc40b07e277d09f00652e98a32bed7e13;hpb=c2e64f71d075bbc916f343916ff1e679f642a821;p=youtube-dl diff --git a/youtube_dl/extractor/twitch.py b/youtube_dl/extractor/twitch.py index 741df7cbc..4b0d8988d 100644 --- a/youtube_dl/extractor/twitch.py +++ b/youtube_dl/extractor/twitch.py @@ -349,6 +349,13 @@ class TwitchStreamIE(TwitchBaseIE): % (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')) @@ -379,4 +386,4 @@ class TwitchStreamIE(TwitchBaseIE): 'view_count': view_count, 'formats': formats, 'is_live': True, - } \ No newline at end of file + }