]> git.bitcoin.ninja Git - youtube-dl/commitdiff
[vk] Fix youtube extraction
authorSergey M․ <dstftw@gmail.com>
Wed, 8 Jul 2015 14:34:50 +0000 (20:34 +0600)
committerSergey M․ <dstftw@gmail.com>
Wed, 8 Jul 2015 14:34:50 +0000 (20:34 +0600)
youtube_dl/extractor/vk.py

index 0f7ce45ca7cc0c641ae69b58943f9252a4bfb7ba..697064175a78f639965e19b3f9768a941c66ff68 100644 (file)
@@ -195,10 +195,11 @@ class VKIE(InfoExtractor):
             if re.search(error_re, info_page):
                 raise ExtractorError(error_msg % video_id, expected=True)
 
-        m_yt = re.search(r'src="(http://www.youtube.com/.*?)"', info_page)
-        if m_yt is not None:
-            self.to_screen('Youtube video detected')
-            return self.url_result(m_yt.group(1), 'Youtube')
+        youtube_url = self._search_regex(
+            r'<iframe[^>]+src="((?:https?:)?//www.youtube.com/embed/[^"]+)"',
+            info_page, 'youtube iframe', default=None)
+        if youtube_url:
+            return self.url_result(youtube_url, 'Youtube', video_id)
 
         m_rutube = re.search(
             r'\ssrc="((?:https?:)?//rutube\.ru\\?/video\\?/embed(?:.*?))\\?"', info_page)