projects
/
youtube-dl
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
1ecb5d1
)
[bilibili] Show georestriction error
author
Sergey M․
<dstftw@gmail.com>
Sat, 18 Jul 2015 11:36:46 +0000
(17:36 +0600)
committer
Sergey M․
<dstftw@gmail.com>
Sat, 18 Jul 2015 11:36:46 +0000
(17:36 +0600)
youtube_dl/extractor/bilibili.py
patch
|
blob
|
history
diff --git
a/youtube_dl/extractor/bilibili.py
b/youtube_dl/extractor/bilibili.py
index bf60450c2f3753aa64d5ae11069bec98b67f23dc..ecc17ebebca9e1819fc804f37d48dcceb80c44c5 100644
(file)
--- a/
youtube_dl/extractor/bilibili.py
+++ b/
youtube_dl/extractor/bilibili.py
@@
-41,8
+41,15
@@
class BiliBiliIE(InfoExtractor):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
- if self._search_regex(r'(此视频不存在或被删除)', webpage, 'error message', default=None):
- raise ExtractorError('The video does not exist or was deleted', expected=True)
+ if '(此视频不存在或被删除)' in webpage:
+ raise ExtractorError(
+ 'The video does not exist or was deleted', expected=True)
+
+ if '>你没有权限浏览! 由于版权相关问题 我们不对您所在的地区提供服务<' in webpage:
+ raise ExtractorError(
+ 'The video is not available in your region due to copyright reasons',
+ expected=True)
+
video_code = self._search_regex(
r'(?s)<div itemprop="video".*?>(.*?)</div>', webpage, 'video code')
video_code = self._search_regex(
r'(?s)<div itemprop="video".*?>(.*?)</div>', webpage, 'video code')