]> git.bitcoin.ninja Git - youtube-dl/blobdiff - youtube_dl/extractor/eagleplatform.py
[eagleplatform] Make _handle_error staticmethod
[youtube-dl] / youtube_dl / extractor / eagleplatform.py
index 8bf88c77d55cd1636a5a6e7c6ec008d6f1451335..ee24242a8373d1addaa0f19a086e553a6665e90e 100644 (file)
@@ -48,7 +48,8 @@ class EaglePlatformIE(InfoExtractor):
         'skip': 'Georestricted',
     }]
 
-    def _handle_error(self, response):
+    @staticmethod
+    def _handle_error(response):
         status = int_or_none(response.get('status', 200))
         if status != 200:
             raise ExtractorError(' '.join(response['errors']), expected=True)
@@ -89,7 +90,9 @@ class EaglePlatformIE(InfoExtractor):
             'mp4', entry_protocol='m3u8_native')
 
         mp4_url = self._get_video_url(
-            secure_m3u8.replace("m3u8", "mp4").replace("hlsvod", "mp4").replace("hls", "mp4"),
+            # Secure mp4 URL is constructed according to Player.prototype.mp4 from
+            # http://lentaru.media.eagleplatform.com/player/player.js
+            re.sub(r'm3u8|hlsvod|hls|f4m', 'mp4', secure_m3u8),
             video_id, 'Downloading mp4 JSON')
         formats.append({'url': mp4_url, 'format_id': 'mp4'})