From 37fb591c0b566d75fe49f8524944505f1c8667ec Mon Sep 17 00:00:00 2001 From: Adrian Heine Date: Fri, 11 Sep 2020 23:31:44 +0200 Subject: [PATCH] [bitchute] Fix error for geoblocking Closes #26564. --- youtube_dl/extractor/bitchute.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/youtube_dl/extractor/bitchute.py b/youtube_dl/extractor/bitchute.py index 0c773e66e..92fc70b5a 100644 --- a/youtube_dl/extractor/bitchute.py +++ b/youtube_dl/extractor/bitchute.py @@ -6,6 +6,8 @@ from .common import InfoExtractor from ..utils import ( + ExtractorError, + GeoRestrictedError, orderedSet, unified_strdate, urlencode_postdata, @@ -59,8 +61,14 @@ def _real_extract(self, url): 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') + if error == 'Video Unavailable': + raise GeoRestrictedError(error) + raise ExtractorError(error) + formats = entries[0]['formats'] self._check_formats(formats, video_id) self._sort_formats(formats)