From d30180d4f3e1c0f1f01f7a3aa3d3fa250ce23b15 Mon Sep 17 00:00:00 2001 From: vallovic Date: Fri, 23 Apr 2021 23:02:04 +0100 Subject: [PATCH] Consider multi-part videos in filename output --- youtube_dl/extractor/rtp.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/youtube_dl/extractor/rtp.py b/youtube_dl/extractor/rtp.py index 2f9360e12..da30a7789 100644 --- a/youtube_dl/extractor/rtp.py +++ b/youtube_dl/extractor/rtp.py @@ -40,6 +40,14 @@ class RTPIE(InfoExtractor): title = self._html_search_regex(r'(.+?)', webpage, 'title') + # Replace irrelevant text in title + title = title.replace(' - RTP Play - RTP', '') + + # Check if it's a video split in parts, if so add part number to title + part = self._html_search_regex(r'section\-parts.*(.+?).*', webpage, 'part', default=None) + if part: + title = f'{title} {part}' + # Get JS object js_object = self._search_regex(r'(?s)RTPPlayer *\( *({.+?}) *\);', webpage, 'player config')