Merge branch 'lel-amri-twitch-fix'

pull/2/head
Tom-Oliver Heidel 4 years ago
commit 5627160298

@ -458,82 +458,86 @@ class TwitchProfileIE(TwitchPlaylistBaseIE):
class TwitchVideosBaseIE(TwitchPlaylistBaseIE): class TwitchVideosBaseIE(TwitchPlaylistBaseIE):
_VALID_URL_VIDEOS_BASE = r'%s/(?P<id>[^/]+)/videos' % TwitchBaseIE._VALID_URL_BASE _VALID_URL_VIDEOS_BASE = r'%s/(?P<id>[^/]+)/videos' % TwitchBaseIE._VALID_URL_BASE
_VALID_URL_VIDEOS_FILTERS = r'\?(?:.*?[&;])??filter=%s'
_PLAYLIST_PATH = TwitchPlaylistBaseIE._PLAYLIST_PATH + '&broadcast_type=' _PLAYLIST_PATH = TwitchPlaylistBaseIE._PLAYLIST_PATH + '&broadcast_type='
class TwitchAllVideosIE(TwitchVideosBaseIE): class TwitchAllVideosIE(TwitchVideosBaseIE):
IE_NAME = 'twitch:videos:all' IE_NAME = 'twitch:videos:all'
_VALID_URL = r'%s/all' % TwitchVideosBaseIE._VALID_URL_VIDEOS_BASE _VALID_URL = '%s/?(?:(?:%s)|$)' % (
TwitchVideosBaseIE._VALID_URL_VIDEOS_BASE,
TwitchVideosBaseIE._VALID_URL_VIDEOS_FILTERS % 'all'
)
_PLAYLIST_PATH = TwitchVideosBaseIE._PLAYLIST_PATH + 'archive,upload,highlight' _PLAYLIST_PATH = TwitchVideosBaseIE._PLAYLIST_PATH + 'archive,upload,highlight'
_PLAYLIST_TYPE = 'all videos' _PLAYLIST_TYPE = 'all videos'
_TESTS = [{ _TESTS = [{
'url': 'https://www.twitch.tv/spamfish/videos/all', 'url': 'https://www.twitch.tv/spamfish/videos?filter=all&sort=time',
'info_dict': { 'info_dict': {
'id': '497952', 'id': '497952',
'title': 'Spamfish', 'title': 'Spamfish',
}, },
'playlist_mincount': 869, 'playlist_mincount': 869,
}, { }, {
'url': 'https://m.twitch.tv/spamfish/videos/all', 'url': 'https://m.twitch.tv/spamfish/videos/',
'only_matching': True, 'only_matching': True,
}] }]
class TwitchUploadsIE(TwitchVideosBaseIE): class TwitchUploadsIE(TwitchVideosBaseIE):
IE_NAME = 'twitch:videos:uploads' IE_NAME = 'twitch:videos:uploads'
_VALID_URL = r'%s/uploads' % TwitchVideosBaseIE._VALID_URL_VIDEOS_BASE _VALID_URL = '%s/?(?:%s)' % (
TwitchVideosBaseIE._VALID_URL_VIDEOS_BASE,
TwitchVideosBaseIE._VALID_URL_VIDEOS_FILTERS % 'uploads'
)
_PLAYLIST_PATH = TwitchVideosBaseIE._PLAYLIST_PATH + 'upload' _PLAYLIST_PATH = TwitchVideosBaseIE._PLAYLIST_PATH + 'upload'
_PLAYLIST_TYPE = 'uploads' _PLAYLIST_TYPE = 'uploads'
_TESTS = [{ _TESTS = [{
'url': 'https://www.twitch.tv/spamfish/videos/uploads', 'url': 'https://www.twitch.tv/spamfish/videos?filter=uploads&sort=time',
'info_dict': { 'info_dict': {
'id': '497952', 'id': '497952',
'title': 'Spamfish', 'title': 'Spamfish',
}, },
'playlist_mincount': 0, 'playlist_mincount': 0,
}, {
'url': 'https://m.twitch.tv/spamfish/videos/uploads',
'only_matching': True,
}] }]
class TwitchPastBroadcastsIE(TwitchVideosBaseIE): class TwitchPastBroadcastsIE(TwitchVideosBaseIE):
IE_NAME = 'twitch:videos:past-broadcasts' IE_NAME = 'twitch:videos:past-broadcasts'
_VALID_URL = r'%s/past-broadcasts' % TwitchVideosBaseIE._VALID_URL_VIDEOS_BASE _VALID_URL = '%s/?(?:%s)' % (
TwitchVideosBaseIE._VALID_URL_VIDEOS_BASE,
TwitchVideosBaseIE._VALID_URL_VIDEOS_FILTERS % 'archives'
)
_PLAYLIST_PATH = TwitchVideosBaseIE._PLAYLIST_PATH + 'archive' _PLAYLIST_PATH = TwitchVideosBaseIE._PLAYLIST_PATH + 'archive'
_PLAYLIST_TYPE = 'past broadcasts' _PLAYLIST_TYPE = 'past broadcasts'
_TESTS = [{ _TESTS = [{
'url': 'https://www.twitch.tv/spamfish/videos/past-broadcasts', 'url': 'https://www.twitch.tv/spamfish/videos?filter=archives&sort=time',
'info_dict': { 'info_dict': {
'id': '497952', 'id': '497952',
'title': 'Spamfish', 'title': 'Spamfish',
}, },
'playlist_mincount': 0, 'playlist_mincount': 0,
}, {
'url': 'https://m.twitch.tv/spamfish/videos/past-broadcasts',
'only_matching': True,
}] }]
class TwitchHighlightsIE(TwitchVideosBaseIE): class TwitchHighlightsIE(TwitchVideosBaseIE):
IE_NAME = 'twitch:videos:highlights' IE_NAME = 'twitch:videos:highlights'
_VALID_URL = r'%s/highlights' % TwitchVideosBaseIE._VALID_URL_VIDEOS_BASE _VALID_URL = '%s/?(?:%s)' % (
TwitchVideosBaseIE._VALID_URL_VIDEOS_BASE,
TwitchVideosBaseIE._VALID_URL_VIDEOS_FILTERS % 'highlights'
)
_PLAYLIST_PATH = TwitchVideosBaseIE._PLAYLIST_PATH + 'highlight' _PLAYLIST_PATH = TwitchVideosBaseIE._PLAYLIST_PATH + 'highlight'
_PLAYLIST_TYPE = 'highlights' _PLAYLIST_TYPE = 'highlights'
_TESTS = [{ _TESTS = [{
'url': 'https://www.twitch.tv/spamfish/videos/highlights', 'url': 'https://www.twitch.tv/spamfish/videos?filter=highlights&sort=views',
'info_dict': { 'info_dict': {
'id': '497952', 'id': '497952',
'title': 'Spamfish', 'title': 'Spamfish',
}, },
'playlist_mincount': 805, 'playlist_mincount': 805,
}, {
'url': 'https://m.twitch.tv/spamfish/videos/highlights',
'only_matching': True,
}] }]

Loading…
Cancel
Save