From 7cbe4b5f33e4241558f1f976981c5d2ab345a751 Mon Sep 17 00:00:00 2001 From: Robert Damas Date: Thu, 17 Jul 2025 19:56:47 +0200 Subject: [PATCH] Dont't trust substack's webpage "post.type" A substack "podcast" type can also have a video. This commit looks for "videoUpload" elements regardless of content type. If it has a video url add it to formats. Closes #13594 --- yt_dlp/extractor/substack.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/yt_dlp/extractor/substack.py b/yt_dlp/extractor/substack.py index b70d40f2ca..3fa5e3218d 100644 --- a/yt_dlp/extractor/substack.py +++ b/yt_dlp/extractor/substack.py @@ -107,7 +107,9 @@ def _real_extract(self, url): post_type = webpage_info['post']['type'] formats, subtitles = [], {} - if post_type == 'podcast': + if webpage_info['post'].get('videoUpload'): + formats, subtitles = self._extract_video_formats(webpage_info['post']['videoUpload']['id'], canonical_url) + if webpage_info['post'].get('podcast_url'): fmt = {'url': webpage_info['post']['podcast_url']} if not determine_ext(fmt['url'], default_ext=None): # The redirected format URL expires but the original URL doesn't, @@ -117,9 +119,7 @@ def _real_extract(self, url): 'Resolving podcast file extension', 'Podcast URL is invalid').url) formats.append(fmt) - elif post_type == 'video': - formats, subtitles = self._extract_video_formats(webpage_info['post']['videoUpload']['id'], canonical_url) - else: + if not formats: self.raise_no_formats(f'Page type "{post_type}" is not supported') return {