0
0
Fork 0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-11-27 03:03:01 +00:00

Merge pull request #8 from geauxlo/master

[twitch]
This commit is contained in:
Tom-Oliver Heidel 2020-08-31 23:36:08 +02:00 committed by GitHub
commit 70ef7d5f08
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -380,11 +380,13 @@ class TwitchPlaylistBaseIE(TwitchBaseIE):
_PLAYLIST_PATH = 'kraken/channels/%s/videos/?offset=%d&limit=%d' _PLAYLIST_PATH = 'kraken/channels/%s/videos/?offset=%d&limit=%d'
_PAGE_LIMIT = 100 _PAGE_LIMIT = 100
def _extract_playlist(self, channel_id): def _extract_playlist(self, channel_name):
info = self._call_api( info = self._call_api(
'kraken/channels/%s' % channel_id, 'kraken/users?login=%s' % channel_name,
channel_id, 'Downloading channel info JSON') channel_name, 'Downloading channel info JSON')
channel_name = info.get('display_name') or info.get('name') info = info['users'][0]
channel_id = info['_id']
channel_name = info.get('display_name') or info.get('name') or channel_name
entries = [] entries = []
offset = 0 offset = 0
limit = self._PAGE_LIMIT limit = self._PAGE_LIMIT
@ -444,7 +446,7 @@ class TwitchProfileIE(TwitchPlaylistBaseIE):
_TESTS = [{ _TESTS = [{
'url': 'http://www.twitch.tv/vanillatv/profile', 'url': 'http://www.twitch.tv/vanillatv/profile',
'info_dict': { 'info_dict': {
'id': 'vanillatv', 'id': '22744919',
'title': 'VanillaTV', 'title': 'VanillaTV',
}, },
'playlist_mincount': 412, 'playlist_mincount': 412,
@ -468,7 +470,7 @@ class TwitchAllVideosIE(TwitchVideosBaseIE):
_TESTS = [{ _TESTS = [{
'url': 'https://www.twitch.tv/spamfish/videos/all', 'url': 'https://www.twitch.tv/spamfish/videos/all',
'info_dict': { 'info_dict': {
'id': 'spamfish', 'id': '497952',
'title': 'Spamfish', 'title': 'Spamfish',
}, },
'playlist_mincount': 869, 'playlist_mincount': 869,
@ -487,7 +489,7 @@ class TwitchUploadsIE(TwitchVideosBaseIE):
_TESTS = [{ _TESTS = [{
'url': 'https://www.twitch.tv/spamfish/videos/uploads', 'url': 'https://www.twitch.tv/spamfish/videos/uploads',
'info_dict': { 'info_dict': {
'id': 'spamfish', 'id': '497952',
'title': 'Spamfish', 'title': 'Spamfish',
}, },
'playlist_mincount': 0, 'playlist_mincount': 0,
@ -506,7 +508,7 @@ class TwitchPastBroadcastsIE(TwitchVideosBaseIE):
_TESTS = [{ _TESTS = [{
'url': 'https://www.twitch.tv/spamfish/videos/past-broadcasts', 'url': 'https://www.twitch.tv/spamfish/videos/past-broadcasts',
'info_dict': { 'info_dict': {
'id': 'spamfish', 'id': '497952',
'title': 'Spamfish', 'title': 'Spamfish',
}, },
'playlist_mincount': 0, 'playlist_mincount': 0,
@ -525,7 +527,7 @@ class TwitchHighlightsIE(TwitchVideosBaseIE):
_TESTS = [{ _TESTS = [{
'url': 'https://www.twitch.tv/spamfish/videos/highlights', 'url': 'https://www.twitch.tv/spamfish/videos/highlights',
'info_dict': { 'info_dict': {
'id': 'spamfish', 'id': '497952',
'title': 'Spamfish', 'title': 'Spamfish',
}, },
'playlist_mincount': 805, 'playlist_mincount': 805,