1
0
Fork 0
mirror of https://github.com/ytdl-org/youtube-dl.git synced 2024-11-16 21:15:40 +00:00

[extractor/mtv] fix mgid extraction

Fixes: #29814, #30139
This commit is contained in:
kikuyan 2021-10-25 10:38:32 +09:00 committed by dirkf
parent a803582717
commit 76f2b63a26

View file

@ -290,7 +290,17 @@ class MTVServicesInfoExtractor(InfoExtractor):
main_container = self._extract_child_with_type(data, 'MainContainer') main_container = self._extract_child_with_type(data, 'MainContainer')
ab_testing = self._extract_child_with_type(main_container, 'ABTesting') ab_testing = self._extract_child_with_type(main_container, 'ABTesting')
video_player = self._extract_child_with_type(ab_testing or main_container, 'VideoPlayer') video_player = self._extract_child_with_type(ab_testing or main_container, 'VideoPlayer')
mgid = video_player['props']['media']['video']['config']['uri'] if video_player:
mgid = video_player['props']['media']['video']['config']['uri']
else:
flex_wrapper = self._extract_child_with_type(ab_testing or main_container, 'FlexWrapper')
auth_suite_wrapper = self._extract_child_with_type(flex_wrapper, 'AuthSuiteWrapper')
player = self._extract_child_with_type(auth_suite_wrapper or flex_wrapper, 'Player')
if player:
mgid = player['props']['videoDetail']['mgid']
if not mgid:
raise ExtractorError('Could not extract mgid')
return mgid return mgid