Handle video pages without vevo IDs (Fixes #923)
[youtube-dl] / youtube_dl / extractor / youtube.py
index 35b95fdc2332f78288f3fdfc26fd271a5db8e353..23ee24d7064e79d9b397169e5e5923db704d0a08 100644 (file)
@@ -484,11 +484,15 @@ class YoutubeIE(InfoExtractor):
 
         try:
             mobj = re.search(r';ytplayer.config = ({.*?});', video_webpage)
+            if not mobj:
+                raise ValueError('Could not find vevo ID')
             info = json.loads(mobj.group(1))
             args = info['args']
-            if args.get('ptk','') == 'vevo' or 'dashmpd' in args:
-                # Vevo videos with encrypted signatures
-                self.to_screen(u'%s: Vevo video detected.' % video_id)
+            # Easy way to know if the 's' value is in url_encoded_fmt_stream_map
+            # this signatures are encrypted
+            m_s = re.search(r'[&,]s=', args['url_encoded_fmt_stream_map'])
+            if m_s is not None:
+                self.to_screen(u'%s: Encrypted signatures detected.' % video_id)
                 video_info['url_encoded_fmt_stream_map'] = [args['url_encoded_fmt_stream_map']]
         except ValueError:
             pass