about summary refs log tree commit diff
diff options
context:
space:
mode:
authordirkf <fieldhouse@gmx.net>2021-12-09 00:55:04 +0000
committerdirkf <fieldhouse@gmx.net>2022-02-05 02:32:45 +0000
commite00b0eab1e78ed822683b2689f60eab85514ac42 (patch)
tree76df1281ef77b8b00529ca028b2f1cd8935f8f2f
parent005339d6375f2d2a4cec962b1c1a157c1dffbf8f (diff)
downloadyoutube-dl-e00b0eab1e78ed822683b2689f60eab85514ac42.tar.gz
youtube-dl-e00b0eab1e78ed822683b2689f60eab85514ac42.tar.xz
youtube-dl-e00b0eab1e78ed822683b2689f60eab85514ac42.zip
[applepodcasts] Improve format extraction
Set acodec and vcodec, etc, to avoid breaking, eg, bestaudio
-rw-r--r--youtube_dl/extractor/applepodcasts.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/youtube_dl/extractor/applepodcasts.py b/youtube_dl/extractor/applepodcasts.py
index f0186d4bf..dd413a289 100644
--- a/youtube_dl/extractor/applepodcasts.py
+++ b/youtube_dl/extractor/applepodcasts.py
@@ -7,6 +7,7 @@ from ..utils import (
     clean_podcast_url,
     get_element_by_class,
     int_or_none,
+    parse_codecs,
     parse_iso8601,
     try_get,
 )
@@ -74,7 +75,7 @@ class ApplePodcastsIE(InfoExtractor):
                 series = try_get(inc, lambda x: x['attributes']['name'])
         series = series or clean_html(get_element_by_class('podcast-header__identity', webpage))
 
-        return {
+        info = [{
             'id': episode_id,
             'title': episode['name'],
             'url': clean_podcast_url(episode['assetUrl']),
@@ -82,4 +83,9 @@ class ApplePodcastsIE(InfoExtractor):
             'timestamp': parse_iso8601(episode.get('releaseDateTime')),
             'duration': int_or_none(episode.get('durationInMilliseconds'), 1000),
             'series': series,
-        }
+        }]
+        self._sort_formats(info)
+        info = info[0]
+        codecs = parse_codecs(info.get('ext', 'mp3'))
+        info.update(codecs)
+        return info