Merge pull request #7320 from remitamine/adobetv
[youtube-dl] / youtube_dl / extractor / vice.py
index e3ad4ef54fab43d0af44e847826a8b70f04e1991..7df87c31ce2e707fc0d82c2525a56e49cb179756 100644 (file)
@@ -1,5 +1,4 @@
 from __future__ import unicode_literals
-import re
 
 from .common import InfoExtractor
 from .ooyala import OoyalaIE
@@ -7,7 +6,7 @@ from ..utils import ExtractorError
 
 
 class ViceIE(InfoExtractor):
-    _VALID_URL = r'https?://(?:.+?\.)?vice\.com/.*?/(?P<name>.+)'
+    _VALID_URL = r'https?://(?:.+?\.)?vice\.com/(?:[^/]+/)+(?P<id>.+)'
 
     _TESTS = [
         {
@@ -16,6 +15,7 @@ class ViceIE(InfoExtractor):
                 'id': '43cW1mYzpia9IlestBjVpd23Yu3afAfp',
                 'ext': 'mp4',
                 'title': 'VICE_COWBOYCAPITALISTS_PART01_v1_VICE_WM_1080p.mov',
+                'duration': 725983,
             },
             'params': {
                 # Requires ffmpeg (m3u8 manifest)
@@ -23,23 +23,13 @@ class ViceIE(InfoExtractor):
             },
         }, {
             'url': 'https://news.vice.com/video/experimenting-on-animals-inside-the-monkey-lab',
-            'info_dict': {
-                'id': 'N2bzkydjraWDGwnt8jAttCF6Y0PDv4Zj',
-                'ext': 'mp4',
-                'title': 'VICE News - Inside the Monkey Lab',
-                'description': 'md5:1f660d467d3515f29d11e5ef742a4b82',
-            },
-            'params': {
-                # Requires ffmpeg (m3u8 manifest)
-                'skip_download': True,
-            },
+            'only_matching': True,
         }
     ]
 
     def _real_extract(self, url):
-        mobj = re.match(self._VALID_URL, url)
-        name = mobj.group('name')
-        webpage = self._download_webpage(url, name)
+        video_id = self._match_id(url)
+        webpage = self._download_webpage(url, video_id)
         try:
             embed_code = self._search_regex(
                 r'embedCode=([^&\'"]+)', webpage,