mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-09-10 00:58:17 +02:00
[twitch:stream] Improve _VALID_URL (closes #11971)
This commit is contained in:
parent
8e4041cf3f
commit
9db8f6c540
@ -447,7 +447,14 @@ class TwitchHighlightsIE(TwitchVideosBaseIE):
|
|||||||
|
|
||||||
class TwitchStreamIE(TwitchBaseIE):
|
class TwitchStreamIE(TwitchBaseIE):
|
||||||
IE_NAME = 'twitch:stream'
|
IE_NAME = 'twitch:stream'
|
||||||
_VALID_URL = r'%s/(?P<id>[^/#?]+)/?(?:\#.*)?$' % TwitchBaseIE._VALID_URL_BASE
|
_VALID_URL = r'''(?x)
|
||||||
|
https?://
|
||||||
|
(?:
|
||||||
|
(?:www\.)?twitch\.tv/|
|
||||||
|
player\.twitch\.tv/\?.*?\bchannel=
|
||||||
|
)
|
||||||
|
(?P<id>[^/#?]+)
|
||||||
|
'''
|
||||||
|
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
'url': 'http://www.twitch.tv/shroomztv',
|
'url': 'http://www.twitch.tv/shroomztv',
|
||||||
@ -471,8 +478,25 @@ class TwitchStreamIE(TwitchBaseIE):
|
|||||||
}, {
|
}, {
|
||||||
'url': 'http://www.twitch.tv/miracle_doto#profile-0',
|
'url': 'http://www.twitch.tv/miracle_doto#profile-0',
|
||||||
'only_matching': True,
|
'only_matching': True,
|
||||||
|
}, {
|
||||||
|
'url': 'https://player.twitch.tv/?channel=lotsofs',
|
||||||
|
'only_matching': True,
|
||||||
}]
|
}]
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def suitable(cls, url):
|
||||||
|
return (False
|
||||||
|
if any(ie.suitable(url) for ie in (
|
||||||
|
TwitchVideoIE,
|
||||||
|
TwitchChapterIE,
|
||||||
|
TwitchVodIE,
|
||||||
|
TwitchProfileIE,
|
||||||
|
TwitchAllVideosIE,
|
||||||
|
TwitchUploadsIE,
|
||||||
|
TwitchPastBroadcastsIE,
|
||||||
|
TwitchHighlightsIE))
|
||||||
|
else super(TwitchStreamIE, cls).suitable(url))
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
channel_id = self._match_id(url)
|
channel_id = self._match_id(url)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user