aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl
diff options
context:
space:
mode:
authorYen Chi Hsuan <yan12125@gmail.com>2015-04-21 02:32:10 +0800
committerYen Chi Hsuan <yan12125@gmail.com>2015-04-21 02:32:10 +0800
commit24e21613b670efefd2f284c8e7027023d0a64399 (patch)
treed038c4cf73b2bb4ffd755d620f69a7a692591814 /youtube_dl
parentc6391cd587a26eb3d9bba7296be804f14612e919 (diff)
[bilibili] Capture the video-not-exist message
Diffstat (limited to 'youtube_dl')
-rw-r--r--youtube_dl/extractor/bilibili.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/youtube_dl/extractor/bilibili.py b/youtube_dl/extractor/bilibili.py
index 75d744852..904d9a8b4 100644
--- a/youtube_dl/extractor/bilibili.py
+++ b/youtube_dl/extractor/bilibili.py
@@ -7,6 +7,7 @@ from .common import InfoExtractor
from ..utils import (
int_or_none,
unified_strdate,
+ ExtractorError,
)
@@ -30,6 +31,8 @@ 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)
video_code = self._search_regex(
r'(?s)<div itemprop="video".*?>(.*?)</div>', webpage, 'video code')