X-Git-Url: https://git.rapsys.eu/youtubedl/blobdiff_plain/7df4343e553a9942a290e5e1dffe931261ab844e..d018d3313032e12968a6add6800e51d412e2f602:/youtube_dl/extractor/bilibili.py?ds=inline diff --git a/youtube_dl/extractor/bilibili.py b/youtube_dl/extractor/bilibili.py index 7ca835e..6c66a12 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)