logo

youtube-dl

[mirror] Download/Watch videos from video hosters
commit: 8878789f1117b59186ecc6bf82f462201166a26a
parent a5cf17989b04e559fda9a2731a3b33e881c5cc3c
Author: Sergey M․ <dstftw@gmail.com>
Date:   Sun, 26 Feb 2017 16:50:57 +0700

[dailymotion] Raise GeoRestrictedError

Diffstat:

Myoutube_dl/extractor/dailymotion.py7++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git 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: