1
0
mirror of https://github.com/l1ving/youtube-dl synced 2025-02-09 06:05:36 +08:00

[RTBF] Improve fail-safe

This commit is contained in:
Urgau 2018-08-27 22:20:41 +02:00 committed by GitHub
parent 8e5cc10774
commit 4ccb83efe7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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<extra>\(\d{1,}\/\d{1,}\) - \d{2}\/\d{2}\/\d{4})$', '', title)
if title:
title = re.sub(r'(?P<extra>\(\d{1,}\/\d{1,}\) - \d{2}\/\d{2}\/\d{4})$', '', title)
if description:
description = re.sub(r'(?P<extra>\(\d{1,}\/\d{1,} du \d{2}\/\d{2}\/\d{4}\))$', '', description)