MTVIE: add support for Vevo videos (related #913)
authorJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>
Mon, 24 Jun 2013 11:54:19 +0000 (13:54 +0200)
committerJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>
Mon, 24 Jun 2013 11:54:19 +0000 (13:54 +0200)
youtube_dl/extractor/mtv.py
youtube_dl/extractor/vevo.py

index a801c8123eb66d153e1752ccb7d1fbc1e0ac7ee6..969db71139b1f81d290ad6549ed3b3d8207da0c7 100644 (file)
@@ -27,6 +27,14 @@ class MTVIE(InfoExtractor):
 
         webpage = self._download_webpage(url, video_id)
 
+        # Some videos come from Vevo.com
+        m_vevo = re.search(r'isVevoVideo = true;.*?vevoVideoId = "(.*?)";',
+                           webpage, re.DOTALL)
+        if m_vevo:
+            vevo_id = m_vevo.group(1);
+            self.to_screen(u'Vevo video detected: %s' % vevo_id)
+            return self.url_result('vevo:%s' % vevo_id, ie='Vevo')
+
         #song_name = self._html_search_regex(r'<meta name="mtv_vt" content="([^"]+)"/>',
         #    webpage, u'song name', fatal=False)
 
index 7aa04ef6893375dd6bc3551028fe014fdf1069db..aa88e1a92e587a9d68075ac6a5196e35ce7857af 100644 (file)
@@ -8,7 +8,11 @@ from ..utils import (
 )
 
 class VevoIE(InfoExtractor):
-    _VALID_URL = r'http://www.vevo.com/watch/.*?/.*?/(?P<id>.*)$'
+    """
+    Accecps urls from vevo.com or in the format 'vevo:{id}'
+    (currently used by MTVIE)
+    """
+    _VALID_URL = r'((http://www.vevo.com/watch/.*?/.*?/)|(vevo:))(?P<id>.*)$'
 
     def _real_extract(self, url):
         mobj = re.match(self._VALID_URL, url)