From 501c9d526779444d9d8e6a69ec46a760a7cbf48a Mon Sep 17 00:00:00 2001 From: c-basalt <117849907+c-basalt@users.noreply.github.com> Date: Mon, 7 Oct 2024 12:47:47 -0400 Subject: [PATCH] update headers --- yt_dlp/extractor/rplaylive.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/yt_dlp/extractor/rplaylive.py b/yt_dlp/extractor/rplaylive.py index 935430d730..c75f8a83cd 100644 --- a/yt_dlp/extractor/rplaylive.py +++ b/yt_dlp/extractor/rplaylive.py @@ -60,10 +60,19 @@ def requestor_query(self): @property def jwt_header(self): return { + 'Origin': 'https://rplay.live', 'Referer': 'https://rplay.live/', 'Authorization': self.jwt_token or 'null', } + @property + def butter_header(self): + return { + 'Origin': 'https://rplay.live', + 'Referer': 'https://rplay.live/', + 'Butter': self.get_butter_token(), + } + def _login_hint(self, **kwargs): return (f'Use --username and --password, --netrc-cmd, --netrc ({self._NETRC_MACHINE}) ' 'or --extractor-args "rplaylive:jwt_token=xxx" to provide account credentials') @@ -201,15 +210,14 @@ def _real_extract(self, url): msg += f'. {self._login_hint()}' raise ExtractorError(msg, expected=True) - formats = self._extract_m3u8_formats(m3u8_url, video_id, headers={ - 'Referer': 'https://rplay.live/', 'Butter': self.get_butter_token()}) + formats = self._extract_m3u8_formats(m3u8_url, video_id, headers=self.butter_header) for fmt in formats: - m3u8_doc = self._download_webpage(fmt['url'], video_id, 'getting m3u8 contents', headers={ - 'Referer': 'https://rplay.live/', 'Butter': self.get_butter_token()}) + m3u8_doc = self._download_webpage(fmt['url'], video_id, 'getting m3u8 contents', headers=self.butter_header) fmt['url'] = encode_data_uri(m3u8_doc.encode(), 'application/x-mpegurl') match = re.search(r'^#EXT-X-KEY.*?URI="([^"]+)"', m3u8_doc, flags=re.M) if match: urlh = self._request_webpage(match[1], video_id, 'getting hls key', headers={ + 'Origin': 'https://rplay.live', 'Referer': 'https://rplay.live/', 'rplay-private-content-requestor': self.user_id or 'not-logged-in', 'age': random.randint(1, 4999),