diff --git a/youtube_dl/extractor/bitchute.py b/youtube_dl/extractor/bitchute.py index 0c773e66e..98f7fedf2 100644 --- a/youtube_dl/extractor/bitchute.py +++ b/youtube_dl/extractor/bitchute.py @@ -6,6 +6,8 @@ import re from .common import InfoExtractor from ..utils import ( + ExtractorError, + GeoRestrictedError, orderedSet, unified_strdate, urlencode_postdata, @@ -59,8 +61,15 @@ class BitChuteIE(InfoExtractor): for format_url in orderedSet(format_urls)] if not formats: - formats = self._parse_html5_media_entries( - url, webpage, video_id)[0]['formats'] + entries = self._parse_html5_media_entries( + url, webpage, video_id) + if not entries: + error = self._html_search_regex(r'

([^<]+)

', webpage, 'error', default='Cannot find video') + error_detail = self._html_search_regex(r'(?s).*

([^<]+)

', webpage, 'error_detail', default=None) + if error_detail == 'This video is unavailable as the contents have been deemed illegal by the authorities within your country.': + raise GeoRestrictedError(error_detail) + raise ExtractorError(error_detail or error) + formats = entries[0]['formats'] self._check_formats(formats, video_id) self._sort_formats(formats)