mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-20 01:42:50 +01:00
[rtp] Thwart latest fingerprinting attempt
This commit is contained in:
parent
96b49af01c
commit
7e6a4cb3dc
@ -29,6 +29,17 @@ class RTPIE(InfoExtractor):
|
|||||||
\s*\.\s*join\(\s*(?:""|'')\s*\)\s*\)\s*\)
|
\s*\.\s*join\(\s*(?:""|'')\s*\)\s*\)\s*\)
|
||||||
''')
|
''')
|
||||||
|
|
||||||
|
__HEADERS = {
|
||||||
|
'Referer': 'https://www.rtp.pt/',
|
||||||
|
'Origin': 'https://www.rtp.pt',
|
||||||
|
'Accept': '*/*',
|
||||||
|
'Accept-Language': 'pt,en-US;q=0.7,en;q=0.3',
|
||||||
|
'Sec-Fetch-Dest': 'empty',
|
||||||
|
'Sec-Fetch-Mode': 'cors',
|
||||||
|
'Sec-Fetch-Site': 'same-site',
|
||||||
|
'Sec-GPC': '1',
|
||||||
|
}
|
||||||
|
|
||||||
def __unobfuscate(self, data, *, video_id):
|
def __unobfuscate(self, data, *, video_id):
|
||||||
if data.startswith('{'):
|
if data.startswith('{'):
|
||||||
data = self._RX_OBFUSCATION.sub(
|
data = self._RX_OBFUSCATION.sub(
|
||||||
@ -65,16 +76,25 @@ def _real_extract(self, url):
|
|||||||
f_hls = f.get('hls')
|
f_hls = f.get('hls')
|
||||||
if f_hls is not None:
|
if f_hls is not None:
|
||||||
formats.extend(self._extract_m3u8_formats(
|
formats.extend(self._extract_m3u8_formats(
|
||||||
f_hls, video_id, 'mp4', 'm3u8_native', m3u8_id='hls'))
|
f_hls, video_id, 'mp4', 'm3u8_native', m3u8_id='hls',
|
||||||
|
headers=self.__HEADERS))
|
||||||
|
|
||||||
f_dash = f.get('dash')
|
f_dash = f.get('dash')
|
||||||
if f_dash is not None:
|
if f_dash is not None:
|
||||||
formats.extend(self._extract_mpd_formats(f_dash, video_id, mpd_id='dash'))
|
formats.extend(self._extract_mpd_formats(
|
||||||
|
f_dash, video_id, mpd_id='dash',
|
||||||
|
headers=self.__HEADERS))
|
||||||
|
|
||||||
|
for fmt in formats:
|
||||||
|
fmt.update({
|
||||||
|
'http_headers': self.__HEADERS,
|
||||||
|
})
|
||||||
else:
|
else:
|
||||||
formats.append({
|
formats.append({
|
||||||
'format_id': 'f',
|
'format_id': 'f',
|
||||||
'url': f,
|
'url': f,
|
||||||
'vcodec': 'none' if config.get('mediaType') == 'audio' else None,
|
'vcodec': 'none' if config.get('mediaType') == 'audio' else None,
|
||||||
|
'http_headers': self.__HEADERS,
|
||||||
})
|
})
|
||||||
|
|
||||||
subtitles = {}
|
subtitles = {}
|
||||||
|
Loading…
Reference in New Issue
Block a user