aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor/youku.py
diff options
context:
space:
mode:
authorYen Chi Hsuan <yan12125@gmail.com>2015-06-15 23:54:55 +0800
committerYen Chi Hsuan <yan12125@gmail.com>2015-06-15 23:54:55 +0800
commit04e7596680bce28beae2436bac0f6d1f01a45210 (patch)
tree4270bd0f7efbdf453f216bf6dd08941e146665ea /youtube_dl/extractor/youku.py
parentf1e66cb2eb40b48c6508acbe57207a2d99792bf0 (diff)
downloadyoutube-dl-04e7596680bce28beae2436bac0f6d1f01a45210.tar.xz
[youku] Better error handling
Diffstat (limited to 'youtube_dl/extractor/youku.py')
-rw-r--r--youtube_dl/extractor/youku.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/youtube_dl/extractor/youku.py b/youtube_dl/extractor/youku.py
index d5b73ebce..91f9f6bff 100644
--- a/youtube_dl/extractor/youku.py
+++ b/youtube_dl/extractor/youku.py
@@ -176,13 +176,15 @@ class YoukuIE(InfoExtractor):
error_code = data1.get('error_code')
if error_code:
- # -8 means blocked outside China.
- # Chinese and English, separated by newline.
error = data1.get('error')
- raise ExtractorError(
- error or 'Server reported error %i' %
- error_code,
- expected=True)
+ if error is not None and '因版权原因无法观看此视频' in error:
+ raise ExtractorError(
+ 'Youku said: Sorry, this video is available in China only', expected=True)
+ else:
+ msg = 'Youku server reported error %i' % error_code
+ if error is not None:
+ msg += ': ' + error
+ raise ExtractorError(msg)
title = data1['title']