]> git.bitcoin.ninja Git - youtube-dl/commitdiff
[eagleplatform] Improve detection of embedded videos (Closes #10409)
authorSergey M․ <dstftw@gmail.com>
Tue, 23 Aug 2016 00:22:14 +0000 (07:22 +0700)
committerSergey M․ <dstftw@gmail.com>
Tue, 23 Aug 2016 00:22:14 +0000 (07:22 +0700)
youtube_dl/extractor/eagleplatform.py

index 12d28d3b9f1e76f84f0f9fa322befd0bfa056f09..d4dfda8cd51af27a0d109d656d9de366faebe76a 100644 (file)
@@ -52,11 +52,24 @@ class EaglePlatformIE(InfoExtractor):
 
     @staticmethod
     def _extract_url(webpage):
+        # Regular iframe embedding
         mobj = re.search(
             r'<iframe[^>]+src=(["\'])(?P<url>(?:https?:)?//.+?\.media\.eagleplatform\.com/index/player\?.+?)\1',
             webpage)
         if mobj is not None:
             return mobj.group('url')
+        # Basic usage embedding (see http://dultonmedia.github.io/eplayer/)
+        mobj = re.search(
+            r'''(?xs)
+                    <script[^>]+
+                        src=(?P<q1>["\'])(?:https?:)?//(?P<host>.+?\.media\.eagleplatform\.com)/player/player\.js(?P=q1)
+                    .+?
+                    <div[^>]+
+                        class=(?P<q2>["\'])eagleplayer(?P=q2)[^>]+
+                        data-id=["\'](?P<id>\d+)
+            ''', webpage)
+        if mobj is not None:
+            return 'eagleplatform:%(host)s:%(id)s' % mobj.groupdict()
 
     @staticmethod
     def _handle_error(response):