1
0
mirror of https://github.com/l1ving/youtube-dl synced 2025-01-21 06:22:51 +08:00

[twitch] Handle new /videos URLs (closes #24263)

Twitch URLs on the path /videos have changed e.g. from
/videos/highlights to /videos?filter=highlights.

I have added support for the new URLs. The old URLs now redirect to the
base videos page, so I have removed support for them.
This commit is contained in:
Will Beaufoy 2020-04-26 14:07:50 +01:00
parent c97f5e934f
commit 27895ec658

View File

@ -438,76 +438,76 @@ class TwitchVideosBaseIE(TwitchPlaylistBaseIE):
class TwitchAllVideosIE(TwitchVideosBaseIE):
IE_NAME = 'twitch:videos:all'
_VALID_URL = r'%s/all' % TwitchVideosBaseIE._VALID_URL_VIDEOS_BASE
_VALID_URL = r'%s\?filter=all' % TwitchVideosBaseIE._VALID_URL_VIDEOS_BASE
_PLAYLIST_PATH = TwitchVideosBaseIE._PLAYLIST_PATH + 'archive,upload,highlight'
_PLAYLIST_TYPE = 'all videos'
_TESTS = [{
'url': 'https://www.twitch.tv/spamfish/videos/all',
'url': 'https://www.twitch.tv/spamfish/videos?filter=all&sort=time',
'info_dict': {
'id': 'spamfish',
'title': 'Spamfish',
},
'playlist_mincount': 869,
'playlist_mincount': 893,
}, {
'url': 'https://m.twitch.tv/spamfish/videos/all',
'url': 'https://m.twitch.tv/spamfish/videos?filter=all&sort=time',
'only_matching': True,
}]
class TwitchUploadsIE(TwitchVideosBaseIE):
IE_NAME = 'twitch:videos:uploads'
_VALID_URL = r'%s/uploads' % TwitchVideosBaseIE._VALID_URL_VIDEOS_BASE
_VALID_URL = r'%s\?filter=uploads' % TwitchVideosBaseIE._VALID_URL_VIDEOS_BASE
_PLAYLIST_PATH = TwitchVideosBaseIE._PLAYLIST_PATH + 'upload'
_PLAYLIST_TYPE = 'uploads'
_TESTS = [{
'url': 'https://www.twitch.tv/spamfish/videos/uploads',
'url': 'https://www.twitch.tv/spamfish/videos?filter=uploads&sort=time',
'info_dict': {
'id': 'spamfish',
'title': 'Spamfish',
},
'playlist_mincount': 0,
}, {
'url': 'https://m.twitch.tv/spamfish/videos/uploads',
'url': 'https://m.twitch.tv/spamfish/videos?filter=uploads&sort=time',
'only_matching': True,
}]
class TwitchPastBroadcastsIE(TwitchVideosBaseIE):
IE_NAME = 'twitch:videos:past-broadcasts'
_VALID_URL = r'%s/past-broadcasts' % TwitchVideosBaseIE._VALID_URL_VIDEOS_BASE
_VALID_URL = r'%s\?filter=archives' % TwitchVideosBaseIE._VALID_URL_VIDEOS_BASE
_PLAYLIST_PATH = TwitchVideosBaseIE._PLAYLIST_PATH + 'archive'
_PLAYLIST_TYPE = 'past broadcasts'
_TESTS = [{
'url': 'https://www.twitch.tv/spamfish/videos/past-broadcasts',
'url': 'https://www.twitch.tv/spamfish/videos?filter=archives&sort=time',
'info_dict': {
'id': 'spamfish',
'title': 'Spamfish',
},
'playlist_mincount': 0,
'playlist_mincount': 25,
}, {
'url': 'https://m.twitch.tv/spamfish/videos/past-broadcasts',
'url': 'https://m.twitch.tv/spamfish/videos?filter=archives&sort=time',
'only_matching': True,
}]
class TwitchHighlightsIE(TwitchVideosBaseIE):
IE_NAME = 'twitch:videos:highlights'
_VALID_URL = r'%s/highlights' % TwitchVideosBaseIE._VALID_URL_VIDEOS_BASE
_VALID_URL = r'%s\?filter=highlights' % TwitchVideosBaseIE._VALID_URL_VIDEOS_BASE
_PLAYLIST_PATH = TwitchVideosBaseIE._PLAYLIST_PATH + 'highlight'
_PLAYLIST_TYPE = 'highlights'
_TESTS = [{
'url': 'https://www.twitch.tv/spamfish/videos/highlights',
'url': 'https://www.twitch.tv/spamfish/videos?filter=highlights&sort=time',
'info_dict': {
'id': 'spamfish',
'title': 'Spamfish',
},
'playlist_mincount': 805,
'playlist_mincount': 867,
}, {
'url': 'https://m.twitch.tv/spamfish/videos/highlights',
'url': 'https://m.twitch.tv/spamfish/videos?filter=highlights&sort=time',
'only_matching': True,
}]