aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2017-02-04 23:21:07 +0700
committerSergey M․ <dstftw@gmail.com>2017-02-04 23:21:07 +0700
commit9db8f6c54021a9c809c8ae65a37544ad566ed159 (patch)
tree4ec7b4883670fb3e75551bf5d1a5bb27d23e6ed9 /youtube_dl
parent8e4041cf3f8e769ee2188f3db4747b7133ab5c2d (diff)
[twitch:stream] Improve _VALID_URL (closes #11971)
Diffstat (limited to 'youtube_dl')
-rw-r--r--youtube_dl/extractor/twitch.py26
1 files changed, 25 insertions, 1 deletions
diff --git a/youtube_dl/extractor/twitch.py b/youtube_dl/extractor/twitch.py
index 1ca159a4d..bbba394b0 100644
--- a/youtube_dl/extractor/twitch.py
+++ b/youtube_dl/extractor/twitch.py
@@ -447,7 +447,14 @@ class TwitchHighlightsIE(TwitchVideosBaseIE):
class TwitchStreamIE(TwitchBaseIE):
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 = [{
'url': 'http://www.twitch.tv/shroomztv',
@@ -471,8 +478,25 @@ class TwitchStreamIE(TwitchBaseIE):
}, {
'url': 'http://www.twitch.tv/miracle_doto#profile-0',
'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):
channel_id = self._match_id(url)