From 4ccb83efe755826acd15d9c93a228a1b42ded914 Mon Sep 17 00:00:00 2001 From: Urgau Date: Mon, 27 Aug 2018 22:20:41 +0200 Subject: [PATCH] [RTBF] Improve fail-safe --- youtube_dl/extractor/rtbf.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/youtube_dl/extractor/rtbf.py b/youtube_dl/extractor/rtbf.py index 1e6aa5bd9..cc3ace546 100644 --- a/youtube_dl/extractor/rtbf.py +++ b/youtube_dl/extractor/rtbf.py @@ -71,12 +71,16 @@ class RTBFIE(InfoExtractor): live, media_id = re.match(self._VALID_URL, url).groups() webpage = self._download_webpage(url, media_id) + + if not webpage: + raise ExtractorError('%s said: failed to download the webpage' % self.IE_NAME, expected=True) - title = self._og_search_title(webpage) + title = self._og_search_title(webpage, default=None) description = self._og_search_description(webpage, default=None) # Remove date from title and description - title = re.sub(r'(?P\(\d{1,}\/\d{1,}\) - \d{2}\/\d{2}\/\d{4})$', '', title) + if title: + title = re.sub(r'(?P\(\d{1,}\/\d{1,}\) - \d{2}\/\d{2}\/\d{4})$', '', title) if description: description = re.sub(r'(?P\(\d{1,}\/\d{1,} du \d{2}\/\d{2}\/\d{4}\))$', '', description)