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