about summary refs log tree commit diff
path: root/youtube_dl/extractor/dailymotion.py
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2017-02-26 16:50:57 +0700
committerSergey M․ <dstftw@gmail.com>2017-02-26 16:52:40 +0700
commit8878789f1117b59186ecc6bf82f462201166a26a (patch)
tree73d857b0e8c143d6c34d483efb8104ceb7e5700f /youtube_dl/extractor/dailymotion.py
parenta5cf17989b04e559fda9a2731a3b33e881c5cc3c (diff)
downloadyoutube-dl-8878789f1117b59186ecc6bf82f462201166a26a.tar.gz
youtube-dl-8878789f1117b59186ecc6bf82f462201166a26a.tar.xz
youtube-dl-8878789f1117b59186ecc6bf82f462201166a26a.zip
[dailymotion] Raise GeoRestrictedError
Diffstat (limited to 'youtube_dl/extractor/dailymotion.py')
-rw-r--r--youtube_dl/extractor/dailymotion.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/youtube_dl/extractor/dailymotion.py b/youtube_dl/extractor/dailymotion.py
index b312401dc..246efde43 100644
--- a/youtube_dl/extractor/dailymotion.py
+++ b/youtube_dl/extractor/dailymotion.py
@@ -282,9 +282,14 @@ class DailymotionIE(DailymotionBaseInfoExtractor):
         }
 
     def _check_error(self, info):
+        error = info.get('error')
         if info.get('error') is not None:
+            title = error['title']
+            # See https://developer.dailymotion.com/api#access-error
+            if error.get('code') == 'DM007':
+                self.raise_geo_restricted(msg=title)
             raise ExtractorError(
-                '%s said: %s' % (self.IE_NAME, info['error']['title']), expected=True)
+                '%s said: %s' % (self.IE_NAME, title), expected=True)
 
     def _get_subtitles(self, video_id, webpage):
         try: