[condenast] Add support for embedded videos (Closes #3929)
authorSergey M․ <dstftw@gmail.com>
Mon, 13 Oct 2014 12:59:35 +0000 (19:59 +0700)
committerSergey M <dstftw@gmail.com>
Mon, 13 Oct 2014 12:59:35 +0000 (19:59 +0700)
youtube_dl/extractor/condenast.py
youtube_dl/extractor/generic.py

index ffbe4903b807faf0442057ebbee27bc9ed838c12..7a7e79360423ec39e341cf651b2aef4ca762d244 100644 (file)
@@ -34,6 +34,8 @@ class CondeNastIE(InfoExtractor):
     _VALID_URL = r'http://(video|www|player)\.(?P<site>%s)\.com/(?P<type>watch|series|video|embed)/(?P<id>[^/?#]+)' % '|'.join(_SITES.keys())
     IE_DESC = 'Condé Nast media group: %s' % ', '.join(sorted(_SITES.values()))
 
+    EMBED_URL = r'(?:https?:)?//player\.(?P<site>%s)\.com/(?P<type>embed)/.+?' % '|'.join(_SITES.keys())
+
     _TEST = {
         'url': 'http://video.wired.com/watch/3d-printed-speakers-lit-with-led',
         'md5': '1921f713ed48aabd715691f774c451f7',
index dfc2ef4e72f0804bc0a9e8f0099252a1f89a83c3..122763a23ff7e6461cf661ea692c14b09112af1c 100644 (file)
@@ -28,6 +28,7 @@ from .brightcove import BrightcoveIE
 from .ooyala import OoyalaIE
 from .rutv import RUTVIE
 from .smotri import SmotriIE
+from .condenast import CondeNastIE
 
 
 class GenericIE(InfoExtractor):
@@ -847,6 +848,12 @@ class GenericIE(InfoExtractor):
         if mobj is not None:
             return self.url_result(mobj.group('url'), 'MLB')
 
+        mobj = re.search(
+            r'<iframe[^>]+?src=(["\'])(?P<url>%s)\1' % CondeNastIE.EMBED_URL,
+            webpage)
+        if mobj is not None:
+            return self.url_result(self._proto_relative_url(mobj.group('url'), scheme='http:'), 'CondeNast')
+
         def check_video(vurl):
             vpath = compat_urlparse.urlparse(vurl).path
             vext = determine_ext(vpath)