]> git.bitcoin.ninja Git - youtube-dl/commitdiff
Add support for embed.ly
authorrzhxeo <rzhxeot7z81b4700@mailcatch.com>
Mon, 24 Feb 2014 00:15:51 +0000 (01:15 +0100)
committerrzhxeo <rzhxeot7z81b4700@mailcatch.com>
Thu, 27 Feb 2014 07:14:28 +0000 (08:14 +0100)
youtube_dl/extractor/generic.py

index 9a2e54d149011f66b08d09860078f23ecf8607a9..e84c022a587cf7cae22f3d6ec33fdbf15f07098b 100644 (file)
@@ -102,6 +102,18 @@ class GenericIE(InfoExtractor):
                 'title': '2cc213299525360.mov',  # that's what we get
             },
         },
+        # embed.ly video
+        {
+            'url': 'http://www.tested.com/science/weird/460206-tested-grinding-coffee-2000-frames-second/',
+            'info_dict': {
+                'id': '9ODmcdjQcHQ',
+                'ext': 'mp4',
+            },
+            # No need to test YoutubeIE here
+            'params': {
+                'skip_download': True,
+            },
+        },
     ]
 
     def report_download_webpage(self, video_id):
@@ -381,6 +393,14 @@ class GenericIE(InfoExtractor):
         if mobj is not None:
             return self.url_result(mobj.group('url'), 'HuffPost')
 
+        # Look for embed.ly
+        mobj = re.search(r'class=["\']embedly-card["\'][^>]href=["\'](?P<url>[^"\']+)', webpage)
+        if mobj is not None:
+            return self.url_result(mobj.group('url'))
+        mobj = re.search(r'class=["\']embedly-embed["\'][^>]src=["\'][^"\']*url=(?P<url>[^&]+)', webpage)
+        if mobj is not None:
+            return self.url_result(compat_urllib_parse.unquote(mobj.group('url')))
+
         # Start with something easy: JW Player in SWFObject
         mobj = re.search(r'flashvars: [\'"](?:.*&)?file=(http[^\'"&]*)', webpage)
         if mobj is None: