mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-19 09:25:43 +00:00
[twitch.py] Improved _VALID_URL
This commit is contained in:
parent
a7d44de6da
commit
ca7e9e1cd1
@ -1235,10 +1235,10 @@
|
||||
TwitchChapterIE,
|
||||
TwitchVodIE,
|
||||
TwitchProfileIE,
|
||||
TwitchAllVideosIE,
|
||||
TwitchUploadsIE,
|
||||
TwitchPastBroadcastsIE,
|
||||
TwitchHighlightsIE,
|
||||
TwitchAllVideosIE,
|
||||
TwitchStreamIE,
|
||||
TwitchClipsIE,
|
||||
)
|
||||
|
@ -431,13 +431,17 @@ class TwitchProfileIE(TwitchPlaylistBaseIE):
|
||||
|
||||
|
||||
class TwitchVideosBaseIE(TwitchPlaylistBaseIE):
|
||||
_VALID_URL_VIDEOS_BASE = r'%s/(?P<id>[^/]+)/videos/?\?(?:.*?[&;])??filter=%%s' % 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='
|
||||
|
||||
|
||||
class TwitchAllVideosIE(TwitchVideosBaseIE):
|
||||
IE_NAME = 'twitch:videos:all'
|
||||
_VALID_URL = TwitchVideosBaseIE._VALID_URL_VIDEOS_BASE % 'all'
|
||||
_VALID_URL = '%s(?:/?(?:%s)|[^/?]+?/?)?' % (
|
||||
TwitchVideosBaseIE._VALID_URL_VIDEOS_BASE,
|
||||
TwitchVideosBaseIE._VALID_URL_VIDEOS_FILTERS % 'all'
|
||||
)
|
||||
_PLAYLIST_PATH = TwitchVideosBaseIE._PLAYLIST_PATH + 'archive,upload,highlight'
|
||||
_PLAYLIST_TYPE = 'all videos'
|
||||
|
||||
@ -448,12 +452,18 @@ class TwitchAllVideosIE(TwitchVideosBaseIE):
|
||||
'title': 'Spamfish',
|
||||
},
|
||||
'playlist_mincount': 869,
|
||||
}, {
|
||||
'url': 'https://m.twitch.tv/spamfish/videos/',
|
||||
'only_matching': True,
|
||||
}]
|
||||
|
||||
|
||||
class TwitchUploadsIE(TwitchVideosBaseIE):
|
||||
IE_NAME = 'twitch:videos:uploads'
|
||||
_VALID_URL = TwitchVideosBaseIE._VALID_URL_VIDEOS_BASE % 'uploads'
|
||||
_VALID_URL = '%s/?(?:%s)' % (
|
||||
TwitchVideosBaseIE._VALID_URL_VIDEOS_BASE,
|
||||
TwitchVideosBaseIE._VALID_URL_VIDEOS_FILTERS % 'uploads'
|
||||
)
|
||||
_PLAYLIST_PATH = TwitchVideosBaseIE._PLAYLIST_PATH + 'upload'
|
||||
_PLAYLIST_TYPE = 'uploads'
|
||||
|
||||
@ -469,7 +479,10 @@ class TwitchUploadsIE(TwitchVideosBaseIE):
|
||||
|
||||
class TwitchPastBroadcastsIE(TwitchVideosBaseIE):
|
||||
IE_NAME = 'twitch:videos:past-broadcasts'
|
||||
_VALID_URL = TwitchVideosBaseIE._VALID_URL_VIDEOS_BASE % 'archives'
|
||||
_VALID_URL = '%s/?(?:%s)' % (
|
||||
TwitchVideosBaseIE._VALID_URL_VIDEOS_BASE,
|
||||
TwitchVideosBaseIE._VALID_URL_VIDEOS_FILTERS % 'archives'
|
||||
)
|
||||
_PLAYLIST_PATH = TwitchVideosBaseIE._PLAYLIST_PATH + 'archive'
|
||||
_PLAYLIST_TYPE = 'past broadcasts'
|
||||
|
||||
@ -485,7 +498,10 @@ class TwitchPastBroadcastsIE(TwitchVideosBaseIE):
|
||||
|
||||
class TwitchHighlightsIE(TwitchVideosBaseIE):
|
||||
IE_NAME = 'twitch:videos:highlights'
|
||||
_VALID_URL = TwitchVideosBaseIE._VALID_URL_VIDEOS_BASE % 'highlights'
|
||||
_VALID_URL = '%s/?(?:%s)' % (
|
||||
TwitchVideosBaseIE._VALID_URL_VIDEOS_BASE,
|
||||
TwitchVideosBaseIE._VALID_URL_VIDEOS_FILTERS % 'highlights'
|
||||
)
|
||||
_PLAYLIST_PATH = TwitchVideosBaseIE._PLAYLIST_PATH + 'highlight'
|
||||
_PLAYLIST_TYPE = 'highlights'
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user