From a85625977d39b4ad5bb9b399773700fa20db7587 Mon Sep 17 00:00:00 2001 From: vallovic Date: Sat, 20 Feb 2021 20:42:33 +0000 Subject: [PATCH] 'Estudo em Casa' wasn't working since RTP has a lot of ways of dealing with their code --- youtube_dl/extractor/rtp.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/youtube_dl/extractor/rtp.py b/youtube_dl/extractor/rtp.py index 665c86f14..02716c172 100644 --- a/youtube_dl/extractor/rtp.py +++ b/youtube_dl/extractor/rtp.py @@ -58,7 +58,7 @@ class RTPIE(InfoExtractor): # Insert the decoded HLS file URL into pure JSON string json_string_for_config += '\nfile: "' + decoded_file_url + '",' else: - # 2) ... or it's a direct M3U8 file + # 2) ... or the file URL is not encoded so keep it that way json_string_for_config += '\n' + line elif not stripped_line.startswith("//") and not re.match('fileKey ?:', stripped_line): @@ -68,11 +68,12 @@ class RTPIE(InfoExtractor): # Finally send pure JSON string for JSON parsing config = self._parse_json(json_string_for_config, video_id, js_to_json) - # config = self._parse_json(self._search_regex( - # r'(?s)RTPPlayer ?\( ?({.+?})\);', webpage, - # 'player config'), video_id, js_to_json) + # Check if file URL is directly a string or is still inside object + if isinstance(config['file'], str): + file_url = config['file'] + else: + file_url = config['file']['hls'] - file_url = config['file'] ext = determine_ext(file_url) if ext == 'm3u8':