From cc37829e6850706831d30027417287c367de4d61 Mon Sep 17 00:00:00 2001 From: p1131 Date: Fri, 5 Jun 2020 17:12:31 +0300 Subject: [PATCH] minor improvements --- youtube_dl/extractor/twitch.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/youtube_dl/extractor/twitch.py b/youtube_dl/extractor/twitch.py index a2a77b84e..6cecb7613 100644 --- a/youtube_dl/extractor/twitch.py +++ b/youtube_dl/extractor/twitch.py @@ -576,15 +576,15 @@ class TwitchStreamIE(TwitchBaseIE): def _real_extract(self, url): channel_name = self._match_id(url).lower() try: - # the kraken api (v5) accepts only channel IDS. + # the kraken api (v5) accepts only channel IDs. # kraken/users?login=CHANNELNAME returns a channel's ID from its name channel_id = self._call_api( 'kraken/users?login=%s' % channel_name, - channel_name, 'Getting channel ID').get('users')[0].get('_id') - assert channel_id is not None + channel_name, 'Downloading channel ID').get('users')[0].get('_id') + assert channel_id is not None and channel_id.isdigit() stream = self._call_api( - 'kraken/streams/%s?stream_type=all' % channel_id.lower(), + 'kraken/streams/%s?stream_type=all' % channel_id, channel_name, 'Downloading stream JSON').get('stream') assert stream is not None