mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-08-16 09:28:28 +00:00
fix: Correct SouthParkDeIE _real_extract to use traverse_obj correctly
This commit is contained in:
parent
35c83c26dc
commit
8207f3b824
@ -111,13 +111,14 @@ def _real_extract(self, url):
|
|||||||
data = self._parse_json(self._search_regex(
|
data = self._parse_json(self._search_regex(
|
||||||
r'window\.__DATA__\s*=\s*({.+?});', webpage, 'data'), display_id)
|
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,
|
video_detail = traverse_obj(data,
|
||||||
# Path for regular episodes
|
# Path for regular episodes
|
||||||
('children', lambda _, v: v.get('type') == 'MainContainer',
|
('children', lambda _, v: v.get('type') == 'MainContainer',
|
||||||
'children', 0, 'children', 0, 'props', 'videoDetail'),
|
'children', 0, 'children', 0, 'props', 'videoDetail'),
|
||||||
# Fallback path for special episodes
|
# Fallback path for special episodes
|
||||||
('children', 0, 'videoDetail'))
|
('children', 0, 'videoDetail'),
|
||||||
|
get_all=False)
|
||||||
|
|
||||||
if not video_detail:
|
if not video_detail:
|
||||||
raise ExtractorError('Could not find video data in page')
|
raise ExtractorError('Could not find video data in page')
|
||||||
@ -130,7 +131,7 @@ def _real_extract(self, url):
|
|||||||
'clientPlatform': 'mobile',
|
'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 {
|
return {
|
||||||
'id': video_detail['id'],
|
'id': video_detail['id'],
|
||||||
|
Loading…
Reference in New Issue
Block a user