aboutsummaryrefslogtreecommitdiffstats
path: root/yt_dlp/extractor/generic.py
diff options
context:
space:
mode:
authorbashonly <88596187+bashonly@users.noreply.github.com>2023-03-23 11:28:23 -0500
committerGitHub <noreply@github.com>2023-03-23 16:28:23 +0000
commit5cc0a8fd2e9fec50026fb92170b57993af939e4a (patch)
tree504a0ad72ccb7668cb2818dad1a1b27459f8f5d7 /yt_dlp/extractor/generic.py
parent6994afc030d2a786d8032075ed71a14d7eac5a4f (diff)
downloadhypervideo-pre-5cc0a8fd2e9fec50026fb92170b57993af939e4a.tar.lz
hypervideo-pre-5cc0a8fd2e9fec50026fb92170b57993af939e4a.tar.xz
hypervideo-pre-5cc0a8fd2e9fec50026fb92170b57993af939e4a.zip
[extractor/generic] Accept values for `fragment_query`, `variant_query` (#6600)
Closes #6593 Authored by: bashonly
Diffstat (limited to 'yt_dlp/extractor/generic.py')
-rw-r--r--yt_dlp/extractor/generic.py20
1 files changed, 12 insertions, 8 deletions
diff --git a/yt_dlp/extractor/generic.py b/yt_dlp/extractor/generic.py
index 075bb36de..f9fa01feb 100644
--- a/yt_dlp/extractor/generic.py
+++ b/yt_dlp/extractor/generic.py
@@ -24,7 +24,6 @@ from ..utils import (
mimetype2ext,
orderedSet,
parse_duration,
- parse_qs,
parse_resolution,
smuggle_url,
str_or_none,
@@ -2187,18 +2186,23 @@ class GenericIE(InfoExtractor):
self._downloader.write_debug(f'Identified {num} {name}{format_field(note, None, "; %s")}')
def _extra_manifest_info(self, info, manifest_url):
- if self._configuration_arg('fragment_query'):
- query_string = urllib.parse.urlparse(manifest_url).query
- if query_string:
- info['extra_param_to_segment_url'] = query_string
+ fragment_query = self._configuration_arg('fragment_query', [None], casesense=True)[0]
+ if fragment_query is not None:
+ fragment_query = self._configuration_arg('fragment_query', casesense=True)[0]
+ info['extra_param_to_segment_url'] = (
+ urllib.parse.urlparse(fragment_query).query or fragment_query
+ or urllib.parse.urlparse(manifest_url).query or None)
hex_or_none = lambda x: x if re.fullmatch(r'(0x)?[\da-f]+', x, re.IGNORECASE) else None
- info['hls_aes'] = traverse_obj(self._configuration_arg('hls_key'), {
+ info['hls_aes'] = traverse_obj(self._configuration_arg('hls_key', casesense=True), {
'uri': (0, {url_or_none}), 'key': (0, {hex_or_none}), 'iv': (1, {hex_or_none}),
}) or None
- if self._configuration_arg('variant_query'):
- query = parse_qs(manifest_url)
+ variant_query = self._configuration_arg('variant_query', [None], casesense=True)[0]
+ if variant_query is not None:
+ query = urllib.parse.parse_qs(
+ urllib.parse.urlparse(variant_query).query or variant_query
+ or urllib.parse.urlparse(manifest_url).query)
for fmt in self._downloader._get_formats(info):
fmt['url'] = update_url_query(fmt['url'], query)