mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-08-13 16:08:29 +00:00
fix: Improve SouthParkDeIE to handle various page layouts
This commit is contained in:
parent
52876aa5a7
commit
3228b3de49
@ -110,10 +110,17 @@ def _real_extract(self, url):
|
||||
data = self._parse_json(self._search_regex(
|
||||
r'window\.__DATA__\s*=\s*({.+?});', webpage, 'data'), display_id)
|
||||
|
||||
video_detail = traverse_obj(data, (
|
||||
'children', lambda _, v: v.get('type') == 'MainContainer',
|
||||
'children', 0, 'children', 0, 'props', 'videoDetail'
|
||||
), default=traverse_obj(data, ('children', 0, 'videoDetail')))
|
||||
# Try multiple paths to find the video data, handling both regular and special episodes
|
||||
video_detail = traverse_obj(data, [
|
||||
# Path for regular episodes (more complex)
|
||||
('children', lambda _, v: v.get('type') == 'MainContainer',
|
||||
'children', 0, 'children', 0, 'props', 'videoDetail'),
|
||||
# Fallback path for special episodes (simpler)
|
||||
('children', 0, 'videoDetail'),
|
||||
])
|
||||
|
||||
if not video_detail:
|
||||
raise ExtractorError('Could not find video data in page')
|
||||
|
||||
api_url = video_detail['videoServiceUrl']
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user