From 24e21613b670efefd2f284c8e7027023d0a64399 Mon Sep 17 00:00:00 2001 From: Yen Chi Hsuan Date: Tue, 21 Apr 2015 02:32:10 +0800 Subject: [PATCH] [bilibili] Capture the video-not-exist message --- youtube_dl/extractor/bilibili.py | 3 +++ 1 file changed, 3 insertions(+) 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 ..utils import ( int_or_none, unified_strdate, + ExtractorError, ) @@ -30,6 +31,8 @@ def _real_extract(self, url): 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)
(.*?)
', webpage, 'video code')