projects
/
youtube-dl
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
de765f6
)
[sohu] Enhance error handling
author
Yen Chi Hsuan
<yan12125@gmail.com>
Sat, 9 May 2015 05:19:54 +0000
(13:19 +0800)
committer
Yen Chi Hsuan
<yan12125@gmail.com>
Sat, 9 May 2015 06:02:11 +0000
(14:02 +0800)
youtube_dl/extractor/sohu.py
patch
|
blob
|
history
diff --git
a/youtube_dl/extractor/sohu.py
b/youtube_dl/extractor/sohu.py
index f8a4840f7b210d0092154a0910188a22efd9bf8b..13b9e91333e63322c59d080c86b43fe5b28f19ff 100644
(file)
--- a/
youtube_dl/extractor/sohu.py
+++ b/
youtube_dl/extractor/sohu.py
@@
-8,7
+8,10
@@
from ..compat import (
compat_str,
compat_urllib_request
)
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):
class SohuIE(InfoExtractor):
@@
-117,6
+120,15
@@
class SohuIE(InfoExtractor):
r'var vid ?= ?["\'](\d+)["\']',
webpage, 'video path')
vid_data = _fetch_data(vid, mytv)
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'):
formats_json = {}
for format_id in ('nor', 'high', 'super', 'ori', 'h2644k', 'h2654k'):