about summary refs log tree commit diff
path: root/youtube_dl/extractor/bilibili.py
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2015-07-18 17:36:46 +0600
committerSergey M․ <dstftw@gmail.com>2015-07-18 17:36:46 +0600
commitc6b68648f45498bcacc71cc8f29696fa93259a7a (patch)
tree4f0b87b2455f3138dda489a9dc2e03c35b072696 /youtube_dl/extractor/bilibili.py
parent1ecb5d1d83970d6295c655a37c99e390fb5d7dee (diff)
downloadyoutube-dl-c6b68648f45498bcacc71cc8f29696fa93259a7a.tar.gz
youtube-dl-c6b68648f45498bcacc71cc8f29696fa93259a7a.tar.xz
youtube-dl-c6b68648f45498bcacc71cc8f29696fa93259a7a.zip
[bilibili] Show georestriction error
Diffstat (limited to 'youtube_dl/extractor/bilibili.py')
-rw-r--r--youtube_dl/extractor/bilibili.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/youtube_dl/extractor/bilibili.py b/youtube_dl/extractor/bilibili.py
index bf60450c2..ecc17ebeb 100644
--- 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)
 
-        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')