]> git.bitcoin.ninja Git - youtube-dl/commitdiff
[cracked] Add support for youtube embeds
authorSergey M․ <dstftw@gmail.com>
Thu, 23 Apr 2015 15:49:54 +0000 (21:49 +0600)
committerSergey M․ <dstftw@gmail.com>
Thu, 23 Apr 2015 15:49:54 +0000 (21:49 +0600)
youtube_dl/extractor/cracked.py

index e579863df4461f1e1fa5829c31394d884b981672..8b381dd3a272cdc5de6143aa6c140a2242bc7737 100644 (file)
@@ -30,8 +30,15 @@ class CrackedIE(InfoExtractor):
 
         webpage = self._download_webpage(url, video_id)
 
+        youtube_url = self._search_regex(
+            r'<iframe[^>]+src="((?:https?:)?//www\.youtube\.com/embed/[^"]+)"',
+            webpage, 'youtube url', default=None)
+        if youtube_url:
+            return self.url_result(youtube_url)
+
         video_url = self._html_search_regex(
-            [r'var\s+CK_vidSrc\s*=\s*"([^"]+)"', r'<video\s+src="([^"]+)"'], webpage, 'video URL')
+            [r'var\s+CK_vidSrc\s*=\s*"([^"]+)"', r'<video\s+src="([^"]+)"'],
+            webpage, 'video URL')
 
         title = self._search_regex(
             [r'property="?og:title"?\s+content="([^"]+)"', r'class="?title"?>([^<]+)'],