Check for embedded YouTube player (Fixes #1616)
authorPhilipp Hagemeister <phihag@phihag.de>
Fri, 18 Oct 2013 09:44:57 +0000 (11:44 +0200)
committerPhilipp Hagemeister <phihag@phihag.de>
Fri, 18 Oct 2013 09:44:57 +0000 (11:44 +0200)
youtube_dl/extractor/generic.py

index 89805250cf690c32f1c9ec8d12a00052c26cd8a3..69e0a7bd271dd0965f5c1f6f9c3a7cdce7a3da0b 100644 (file)
@@ -142,12 +142,19 @@ class GenericIE(InfoExtractor):
 
         # Look for embedded Vimeo player
         mobj = re.search(
-            r'<iframe\s+src="(https?://player.vimeo.com/video/.*?)"', webpage)
+            r'<iframe[^>]+?src="(https?://player.vimeo.com/video/.+?)"', webpage)
         if mobj:
             player_url = unescapeHTML(mobj.group(1))
             surl = smuggle_url(player_url, {'Referer': url})
             return self.url_result(surl, 'Vimeo')
 
+        # Look for embedded YouTube player
+        mobj = re.search(
+            r'<iframe[^>]+?src="(https?://(?:www\.)?youtube.com/embed/.+?)"', webpage)
+        if mobj:
+            surl = unescapeHTML(mobj.group(1))
+            return self.url_result(surl, 'Youtube')
+
         # Start with something easy: JW Player in SWFObject
         mobj = re.search(r'flashvars: [\'"](?:.*&)?file=(http[^\'"&]*)', webpage)
         if mobj is None: