X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=youtube_dl%2Fextractor%2Fbilibili.py;h=6c66a12368ea0a963d89ef5922c9d83f3019ddfc;hb=36e6f62cd0883f0f486d1666d010e5d9e6d515bd;hp=7ca835e31f3477f8e46c74804aea36ecfe789686;hpb=4d72df403115458fee2fe29217000580fac029d7;p=youtube-dl diff --git a/youtube_dl/extractor/bilibili.py b/youtube_dl/extractor/bilibili.py index 7ca835e31..6c66a1236 100644 --- a/youtube_dl/extractor/bilibili.py +++ b/youtube_dl/extractor/bilibili.py @@ -3,8 +3,12 @@ from __future__ import unicode_literals import re import itertools +import json from .common import InfoExtractor +from ..compat import ( + compat_etree_fromstring, +) from ..utils import ( int_or_none, unified_strdate, @@ -39,8 +43,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)