]> jfr.im git - yt-dlp.git/blobdiff - yt_dlp/extractor/ccma.py
[ie/crunchyroll] Fix stream extraction (#10005)
[yt-dlp.git] / yt_dlp / extractor / ccma.py
index 9dbaabfa087b4bd33e3a33678879878a7172c5d6..ab840f3016be560dbb9cb062936dbeac07c7a975 100644 (file)
@@ -1,9 +1,7 @@
-# coding: utf-8
-from __future__ import unicode_literals
-
 from .common import InfoExtractor
 from ..utils import (
     clean_html,
+    determine_ext,
     int_or_none,
     parse_duration,
     parse_resolution,
@@ -63,6 +61,7 @@ def _real_extract(self, url):
             'http://dinamics.ccma.cat/pvideo/media.jsp', media_id, query={
                 'media': media_type,
                 'idint': media_id,
+                'format': 'dm',
             })
 
         formats = []
@@ -72,6 +71,10 @@ def _real_extract(self, url):
                 format_url = url_or_none(format_.get('file'))
                 if not format_url:
                     continue
+                if determine_ext(format_url) == 'mpd':
+                    formats.extend(self._extract_mpd_formats(
+                        format_url, media_id, mpd_id='dash', fatal=False))
+                    continue
                 label = format_.get('label')
                 f = parse_resolution(label)
                 f.update({
@@ -84,7 +87,6 @@ def _real_extract(self, url):
                 'url': media_url,
                 'vcodec': 'none' if media_type == 'audio' else None,
             })
-        self._sort_formats(formats)
 
         informacio = media['informacio']
         title = informacio['titol']