mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-21 20:46:36 -05:00
[ie/mediastream] Fix authenticated format extraction (#8657)
Authored by: NickCis
This commit is contained in:
parent
71f28097fe
commit
b03c89309e
1 changed files with 16 additions and 2 deletions
|
@ -3,8 +3,11 @@
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
clean_html,
|
clean_html,
|
||||||
|
filter_dict,
|
||||||
|
parse_qs,
|
||||||
remove_end,
|
remove_end,
|
||||||
traverse_obj,
|
traverse_obj,
|
||||||
|
update_url_query,
|
||||||
urljoin,
|
urljoin,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -108,7 +111,9 @@ def _real_extract(self, url):
|
||||||
|
|
||||||
for message in [
|
for message in [
|
||||||
'Debido a tu ubicación no puedes ver el contenido',
|
'Debido a tu ubicación no puedes ver el contenido',
|
||||||
'You are not allowed to watch this video: Geo Fencing Restriction'
|
'You are not allowed to watch this video: Geo Fencing Restriction',
|
||||||
|
'Este contenido no está disponible en tu zona geográfica.',
|
||||||
|
'El contenido sólo está disponible dentro de',
|
||||||
]:
|
]:
|
||||||
if message in webpage:
|
if message in webpage:
|
||||||
self.raise_geo_restricted()
|
self.raise_geo_restricted()
|
||||||
|
@ -118,7 +123,16 @@ def _real_extract(self, url):
|
||||||
formats, subtitles = [], {}
|
formats, subtitles = [], {}
|
||||||
for video_format in player_config['src']:
|
for video_format in player_config['src']:
|
||||||
if video_format == 'hls':
|
if video_format == 'hls':
|
||||||
fmts, subs = self._extract_m3u8_formats_and_subtitles(player_config['src'][video_format], video_id)
|
params = {
|
||||||
|
'at': 'web-app',
|
||||||
|
'access_token': traverse_obj(parse_qs(url), ('access_token', 0)),
|
||||||
|
}
|
||||||
|
for name, key in (('MDSTRMUID', 'uid'), ('MDSTRMSID', 'sid'), ('MDSTRMPID', 'pid'), ('VERSION', 'av')):
|
||||||
|
params[key] = self._search_regex(
|
||||||
|
rf'window\.{name}\s*=\s*["\']([^"\']+)["\'];', webpage, key, default=None)
|
||||||
|
|
||||||
|
fmts, subs = self._extract_m3u8_formats_and_subtitles(
|
||||||
|
update_url_query(player_config['src'][video_format], filter_dict(params)), video_id)
|
||||||
formats.extend(fmts)
|
formats.extend(fmts)
|
||||||
self._merge_subtitles(subs, target=subtitles)
|
self._merge_subtitles(subs, target=subtitles)
|
||||||
elif video_format == 'mpd':
|
elif video_format == 'mpd':
|
||||||
|
|
Loading…
Reference in a new issue