X-Git-Url: https://git.rapsys.eu/youtubedl/blobdiff_plain/139d14b198add5b26a11ed5dca022feaa6581d98..d018d3313032e12968a6add6800e51d412e2f602:/youtube_dl/extractor/bilibili.py?ds=inline diff --git a/youtube_dl/extractor/bilibili.py b/youtube_dl/extractor/bilibili.py index 2103ed7..6c66a12 100644 --- a/youtube_dl/extractor/bilibili.py +++ b/youtube_dl/extractor/bilibili.py @@ -4,9 +4,11 @@ from __future__ import unicode_literals import re import itertools import json -import xml.etree.ElementTree as ET from .common import InfoExtractor +from ..compat import ( + compat_etree_fromstring, +) from ..utils import ( int_or_none, unified_strdate, @@ -41,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)