mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-11-26 12:11:52 +00:00
[dailymotion] Report errors from player v5
This commit is contained in:
parent
9eb31b265f
commit
583882fdce
1 changed files with 14 additions and 3 deletions
|
@ -96,6 +96,11 @@ class DailymotionIE(DailymotionBaseInfoExtractor):
|
||||||
'uploader': 'HotWaves1012',
|
'uploader': 'HotWaves1012',
|
||||||
'age_limit': 18,
|
'age_limit': 18,
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
# geo-restricted, player v5
|
||||||
|
{
|
||||||
|
'url': 'http://www.dailymotion.com/video/xhza0o',
|
||||||
|
'only_matching': True,
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -124,6 +129,9 @@ class DailymotionIE(DailymotionBaseInfoExtractor):
|
||||||
if player_v5:
|
if player_v5:
|
||||||
player = self._parse_json(player_v5, video_id)
|
player = self._parse_json(player_v5, video_id)
|
||||||
metadata = player['metadata']
|
metadata = player['metadata']
|
||||||
|
|
||||||
|
self._check_error(metadata)
|
||||||
|
|
||||||
formats = []
|
formats = []
|
||||||
for quality, media_list in metadata['qualities'].items():
|
for quality, media_list in metadata['qualities'].items():
|
||||||
for media in media_list:
|
for media in media_list:
|
||||||
|
@ -201,9 +209,7 @@ class DailymotionIE(DailymotionBaseInfoExtractor):
|
||||||
'video info', flags=re.MULTILINE),
|
'video info', flags=re.MULTILINE),
|
||||||
video_id)
|
video_id)
|
||||||
|
|
||||||
if info.get('error') is not None:
|
self._check_error(info)
|
||||||
msg = 'Couldn\'t get video, Dailymotion says: %s' % info['error']['title']
|
|
||||||
raise ExtractorError(msg, expected=True)
|
|
||||||
|
|
||||||
formats = []
|
formats = []
|
||||||
for (key, format_id) in self._FORMATS:
|
for (key, format_id) in self._FORMATS:
|
||||||
|
@ -246,6 +252,11 @@ class DailymotionIE(DailymotionBaseInfoExtractor):
|
||||||
'duration': info['duration']
|
'duration': info['duration']
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def _check_error(self, info):
|
||||||
|
if info.get('error') is not None:
|
||||||
|
msg = 'Couldn\'t get video, Dailymotion says: %s' % info['error']['title']
|
||||||
|
raise ExtractorError(msg, expected=True)
|
||||||
|
|
||||||
def _get_subtitles(self, video_id, webpage):
|
def _get_subtitles(self, video_id, webpage):
|
||||||
try:
|
try:
|
||||||
sub_list = self._download_webpage(
|
sub_list = self._download_webpage(
|
||||||
|
|
Loading…
Reference in a new issue