aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor/sohu.py
diff options
context:
space:
mode:
authorYen Chi Hsuan <yan12125@gmail.com>2015-05-09 13:19:54 +0800
committerYen Chi Hsuan <yan12125@gmail.com>2015-05-09 14:02:11 +0800
commit3dbec410a0e195036025aa3a3792932783f371d2 (patch)
tree3f747426608a8228234a94fd76f98732cba87670 /youtube_dl/extractor/sohu.py
parentde765f6c3188802bb2dea704a645f539fa61c8aa (diff)
[sohu] Enhance error handling
Diffstat (limited to 'youtube_dl/extractor/sohu.py')
-rw-r--r--youtube_dl/extractor/sohu.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/youtube_dl/extractor/sohu.py b/youtube_dl/extractor/sohu.py
index f8a4840f7..13b9e9133 100644
--- a/youtube_dl/extractor/sohu.py
+++ b/youtube_dl/extractor/sohu.py
@@ -8,7 +8,10 @@ from ..compat import (
compat_str,
compat_urllib_request
)
-from ..utils import sanitize_url_path_consecutive_slashes
+from ..utils import (
+ sanitize_url_path_consecutive_slashes,
+ ExtractorError,
+)
class SohuIE(InfoExtractor):
@@ -117,6 +120,15 @@ class SohuIE(InfoExtractor):
r'var vid ?= ?["\'](\d+)["\']',
webpage, 'video path')
vid_data = _fetch_data(vid, mytv)
+ if vid_data['play'] != 1:
+ if vid_data.get('status') == 12:
+ raise ExtractorError(
+ 'Sohu said: There\'s something wrong in the video.',
+ expected=True)
+ else:
+ raise ExtractorError(
+ 'Sohu said: The video is only licensed to users in Mainland China.',
+ expected=True)
formats_json = {}
for format_id in ('nor', 'high', 'super', 'ori', 'h2644k', 'h2654k'):