Fix tests

This commit is contained in:
df 2021-08-09 16:24:12 +01:00
parent a15f994677
commit 08202a62a7
3 changed files with 14 additions and 3 deletions

View File

@ -16,7 +16,7 @@ class ComedyCentralIE(MTVServicesInfoExtractor):
_TESTS = [{ _TESTS = [{
'url': 'http://www.cc.com/video-clips/5ke9v2/the-daily-show-with-trevor-noah-doc-rivers-and-steve-ballmer---the-nba-player-strike', 'url': 'http://www.cc.com/video-clips/5ke9v2/the-daily-show-with-trevor-noah-doc-rivers-and-steve-ballmer---the-nba-player-strike',
'md5': 'b8acb347177c680ff18a292aa2166f80', 'md5': '58e7caf5c7c0c865d9d79f7d151e5090',
'info_dict': { 'info_dict': {
'id': '89ccc86e-1b02-4f83-b0c9-1d9592ecd025', 'id': '89ccc86e-1b02-4f83-b0c9-1d9592ecd025',
'ext': 'mp4', 'ext': 'mp4',
@ -25,6 +25,9 @@ class ComedyCentralIE(MTVServicesInfoExtractor):
'timestamp': 1598670000, 'timestamp': 1598670000,
'upload_date': '20200829', 'upload_date': '20200829',
}, },
'params': {
'hls_prefer_native': False,
},
}, { }, {
'url': 'http://www.cc.com/episodes/pnzzci/drawn-together--american-idol--parody-clip-show-season-3-ep-314', 'url': 'http://www.cc.com/episodes/pnzzci/drawn-together--american-idol--parody-clip-show-season-3-ep-314',
'only_matching': True, 'only_matching': True,
@ -37,10 +40,13 @@ class ComedyCentralIE(MTVServicesInfoExtractor):
'id': '2f56e756-91ec-4d68-8799-e3b710e360e4', 'id': '2f56e756-91ec-4d68-8799-e3b710e360e4',
'ext': 'mp4', 'ext': 'mp4',
'title': 'The Daily Show with Trevor Noah|August 4, 2021|26|NO-EPISODE#|Hottest Take - The Olympics', 'title': 'The Daily Show with Trevor Noah|August 4, 2021|26|NO-EPISODE#|Hottest Take - The Olympics',
'description': 'md5:f877effd54484878f0aaddbe418314f4', 'description': 'md5:104484314a4cba36d8c62b094523efc8',
'timestamp': 1628125200, 'timestamp': 1628125200,
'upload_date': '20210805', 'upload_date': '20210805',
}, },
'params': {
'hls_prefer_native': False,
},
}, ] }, ]

View File

@ -901,6 +901,9 @@ class GenericIE(InfoExtractor):
'timestamp': 1349922600, 'timestamp': 1349922600,
'upload_date': '20121011', 'upload_date': '20121011',
}, },
'params': {
'hls-prefer-native': False,
},
}, },
# YouTube embed via <data-embed-url=""> # YouTube embed via <data-embed-url="">
{ {

View File

@ -292,7 +292,7 @@ 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'] mgid = try_get(video_player, lambda x: x['props']['media']['video']['config']['uri'])
return mgid return mgid
@ -300,6 +300,8 @@ class MTVServicesInfoExtractor(InfoExtractor):
title = url_basename(url) title = url_basename(url)
webpage = self._download_webpage(url, title) webpage = self._download_webpage(url, title)
mgid = self._extract_mgid(webpage) mgid = self._extract_mgid(webpage)
if not mgid:
raise ExtractorError('Unable to determine MTVServices ID (mgid)', expected=True)
videos_info = self._get_videos_info(mgid) videos_info = self._get_videos_info(mgid)
if videos_info and videos_info.get('_type') != 'playlist': if videos_info and videos_info.get('_type') != 'playlist':
videos_info['display_id'] = title videos_info['display_id'] = title