summary refs log tree commit diff
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2016-12-31 22:40:42 +0700
committerSergey M․ <dstftw@gmail.com>2016-12-31 22:40:42 +0700
commit3f1ce16876931f2aa57b566736d875a760f35f43 (patch)
treee338fe556c6ecec83c31b7edb6a9394c26cb81df
parent9a0f999585e392f04541e4f6d5c8d26cf18d31a8 (diff)
downloadyoutube-dl-3f1ce16876931f2aa57b566736d875a760f35f43.tar.gz
youtube-dl-3f1ce16876931f2aa57b566736d875a760f35f43.tar.xz
youtube-dl-3f1ce16876931f2aa57b566736d875a760f35f43.zip
[twitch:vod] Improve _VALID_URL (closes #11537)
-rw-r--r--youtube_dl/extractor/twitch.py33
1 files changed, 11 insertions, 22 deletions
diff --git a/youtube_dl/extractor/twitch.py b/youtube_dl/extractor/twitch.py
index 09efa505b..681f1b676 100644
--- a/youtube_dl/extractor/twitch.py
+++ b/youtube_dl/extractor/twitch.py
@@ -206,8 +206,14 @@ class TwitchChapterIE(TwitchItemBaseIE):
 
 class TwitchVodIE(TwitchItemBaseIE):
     IE_NAME = 'twitch:vod'
-    _VALID_URL_BASE = r'https?://(?:www\.|player\.)?twitch\.tv'
-    _VALID_URL = r'%s/(?:[^/]+/v/|\?video=v)(?P<id>\d+)' % _VALID_URL_BASE
+    _VALID_URL = r'''(?x)
+                    https?://
+                        (?:
+                            (?:www\.)?twitch\.tv/[^/]+/v/|
+                            player\.twitch\.tv/\?.*?\bvideo=v
+                        )
+                        (?P<id>\d+)
+                    '''
     _ITEM_TYPE = 'vod'
     _ITEM_SHORTCUT = 'v'
 
@@ -231,26 +237,6 @@ class TwitchVodIE(TwitchItemBaseIE):
             'skip_download': True,
         },
     }, {
-        # player.twitch.tv URL
-        'url': 'http://player.twitch.tv/?video=v6528877&t=5m10s',
-        'info_dict': {
-            'id': 'v6528877',
-            'ext': 'mp4',
-            'title': 'LCK Summer Split - Week 6 Day 1',
-            'thumbnail': 're:^https?://.*\.jpg$',
-            'duration': 17208,
-            'timestamp': 1435131709,
-            'upload_date': '20150624',
-            'uploader': 'Riot Games',
-            'uploader_id': 'riotgames',
-            'view_count': int,
-            'start_time': 310,
-        },
-        'params': {
-            # m3u8 download
-            'skip_download': True,
-        },
-    }, {
         # Untitled broadcast (title is None)
         'url': 'http://www.twitch.tv/belkao_o/v/11230755',
         'info_dict': {
@@ -270,6 +256,9 @@ class TwitchVodIE(TwitchItemBaseIE):
             'skip_download': True,
         },
         'skip': 'HTTP Error 404: Not Found',
+    }, {
+        'url': 'http://player.twitch.tv/?t=5m10s&video=v6528877',
+        'only_matching': True,
     }]
 
     def _real_extract(self, url):