aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor
diff options
context:
space:
mode:
authorSergey M. <dstftw@gmail.com>2015-10-18 00:54:27 +0600
committerSergey M. <dstftw@gmail.com>2015-10-18 00:54:27 +0600
commit2eb0f72a0ea6bdbf6889efe34027a534a3473a03 (patch)
treed9d52ff0e00cec2401eceb7f2346703ce89fd148 /youtube_dl/extractor
parent8e5b1219489be399de55566090e145c89007fa48 (diff)
parent583882fdce19f8c565402f42523b275f96c91575 (diff)
Merge pull request #7212 from lalinsky/dailymotion-error
[dailymotion] Report errors from player v5
Diffstat (limited to 'youtube_dl/extractor')
-rw-r--r--youtube_dl/extractor/dailymotion.py17
1 files changed, 14 insertions, 3 deletions
diff --git a/youtube_dl/extractor/dailymotion.py b/youtube_dl/extractor/dailymotion.py
index 80a05cfee..ea1edceb1 100644
--- a/youtube_dl/extractor/dailymotion.py
+++ b/youtube_dl/extractor/dailymotion.py
@@ -96,6 +96,11 @@ class DailymotionIE(DailymotionBaseInfoExtractor):
'uploader': 'HotWaves1012',
'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:
player = self._parse_json(player_v5, video_id)
metadata = player['metadata']
+
+ self._check_error(metadata)
+
formats = []
for quality, media_list in metadata['qualities'].items():
for media in media_list:
@@ -201,9 +209,7 @@ class DailymotionIE(DailymotionBaseInfoExtractor):
'video info', flags=re.MULTILINE),
video_id)
- if info.get('error') is not None:
- msg = 'Couldn\'t get video, Dailymotion says: %s' % info['error']['title']
- raise ExtractorError(msg, expected=True)
+ self._check_error(info)
formats = []
for (key, format_id) in self._FORMATS:
@@ -246,6 +252,11 @@ class DailymotionIE(DailymotionBaseInfoExtractor):
'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):
try:
sub_list = self._download_webpage(