]> jfr.im git - yt-dlp.git/blobdiff - yt_dlp/extractor/vidio.py
[extractor] Better error message for DRM (#729)
[yt-dlp.git] / yt_dlp / extractor / vidio.py
index b9ee67d20e7a111c1d83990779468b2792230d2f..571448bf21d4bc2ec28ed059d514e9121bf43182 100644 (file)
@@ -1,7 +1,6 @@
 # coding: utf-8
 from __future__ import unicode_literals
 
-import re
 
 from .common import InfoExtractor
 from ..utils import (
@@ -110,7 +109,7 @@ class VidioIE(VidioBaseIE):
     }]
 
     def _real_extract(self, url):
-        match = re.match(self._VALID_URL, url).groupdict()
+        match = self._match_valid_url(url).groupdict()
         video_id, display_id = match.get('id'), match.get('display_id')
         data = self._call_api('https://api.vidio.com/videos/' + video_id, display_id)
         video = data['videos'][0]
@@ -194,7 +193,7 @@ def _playlist_entries(self, playlist_url, display_id):
 
     def _real_extract(self, url):
         url, idata = unsmuggle_url(url, {})
-        playlist_id, display_id = re.match(self._VALID_URL, url).groups()
+        playlist_id, display_id = self._match_valid_url(url).groups()
 
         playlist_url = idata.get('url')
         if playlist_url:  # Smuggled data contains an API URL. Download only that playlist
@@ -236,7 +235,7 @@ class VidioLiveIE(VidioBaseIE):
     }]
 
     def _real_extract(self, url):
-        video_id, display_id = re.match(self._VALID_URL, url).groups()
+        video_id, display_id = self._match_valid_url(url).groups()
         stream_data = self._call_api(
             'https://www.vidio.com/api/livestreamings/%s/detail' % video_id, display_id)
         stream_meta = stream_data['livestreamings'][0]
@@ -248,8 +247,7 @@ def _real_extract(self, url):
         formats = []
         if stream_meta.get('is_drm'):
             if not self.get_param('allow_unplayable_formats'):
-                self.raise_no_formats(
-                    'This video is DRM protected.', expected=True)
+                self.report_drm(video_id)
         if stream_meta.get('is_premium'):
             sources = self._download_json(
                 'https://www.vidio.com/interactions_stream.json?video_id=%s&type=livestreamings' % video_id,