From 8207f3b82451a67a53fc742247282fe8ae60a00a Mon Sep 17 00:00:00 2001 From: Randalix Date: Wed, 13 Aug 2025 00:10:17 +0200 Subject: [PATCH] fix: Correct SouthParkDeIE _real_extract to use traverse_obj correctly --- yt_dlp/extractor/southpark.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/yt_dlp/extractor/southpark.py b/yt_dlp/extractor/southpark.py index db9f5d8f6..9b79040a2 100644 --- a/yt_dlp/extractor/southpark.py +++ b/yt_dlp/extractor/southpark.py @@ -111,13 +111,14 @@ def _real_extract(self, url): data = self._parse_json(self._search_regex( r'window\.__DATA__\s*=\s*({.+?});', webpage, 'data'), display_id) - # CORRECTED: Provide paths as separate arguments, not a list + # Try multiple paths and, crucially, get only the FIRST match, not a list video_detail = traverse_obj(data, # Path for regular episodes ('children', lambda _, v: v.get('type') == 'MainContainer', 'children', 0, 'children', 0, 'props', 'videoDetail'), # Fallback path for special episodes - ('children', 0, 'videoDetail')) + ('children', 0, 'videoDetail'), + get_all=False) if not video_detail: raise ExtractorError('Could not find video data in page') @@ -130,7 +131,7 @@ def _real_extract(self, url): 'clientPlatform': 'mobile', }) - hls_url = traverse_obj(api_data, ('stitchedstream', 'source'), expected_type=str) + hls_url = traverse_obj(api_data, ('stitchedstream', 'source'), expected_type=str, get_all=False) return { 'id': video_detail['id'],