Repository: yt-dlp/yt-dlp
File: yt_dlp/extractor/generic.py (Python)

Code before:
    def report_detected(self, name, num=1, note=None):
        if num > 1:
            name += 's'
        elif not num:
            return
        else:
            num = 'a'

        self._downloader.write_debug(f'Identified {num} {name}{format_field(note, None, "; %s")}')

    def _extra_manifest_info(self, info, manifest_url, is_info_dict=True):
        extra_info = {}

        if self._configuration_arg('fragment_query'):
            query_string = urllib.parse.urlparse(manifest_url).query
            if query_string:
                extra_info['extra_param_to_segment_url'] = query_string

        hex_or_none = lambda x: x if re.fullmatch(r'(?i)(0x)?[\da-f]+', x) else None
        extra_info['hls_aes'] = traverse_obj(self._configuration_arg('hls_key', []), {
            'uri': (0, {url_or_none}),
            'key': (0, {hex_or_none}),
            'iv': (1, {hex_or_none}),
        }) or None

        info.update(extra_info)

        if self._configuration_arg('variant_query'):
            query = parse_qs(manifest_url)
            if is_info_dict:
                for fmt in info['formats']:
                    fmt['url'] = update_url_query(fmt['url'], query)
            else:
                info['url'] = update_url_query(info['url'], query)

    def _extract_rss(self, url, video_id, doc):
        NS_MAP = {
            'itunes': 'http://www.itunes.com/dtds/podcast-1.0.dtd',
        }

        entries = []
        for it in doc.findall('./channel/item'):
            next_url = next(
                (e.attrib.get('url') for e in it.findall('./enclosure')),
                xpath_text(it, 'link', fatal=False))
            if not next_url:
                continue

            guid = try_call(lambda: it.find('guid').text)
            if guid:
                next_url = smuggle_url(next_url, {'force_videoid': guid})

Review comment (suggestion):
```suggestion
        is_hex = lambda _, v: re.fullmatch(r'(?i)(0x)?[\da-f]+', v)
        info['hls_aes'] = traverse_obj(self._configuration_arg('hls_key'), {
            'uri': (0, {url_or_none}), 'key': (0, is_hex), 'iv': (1, is_hex),
        })
```

Code after:
    def report_detected(self, name, num=1, note=None):
        if num > 1:
            name += 's'
        elif not num:
            return
        else:
            num = 'a'

        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

        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'), {
            '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)
            for fmt in self._downloader._get_formats(info):
                fmt['url'] = update_url_query(fmt['url'], query)

    def _extract_rss(self, url, video_id, doc):
        NS_MAP = {
            'itunes': 'http://www.itunes.com/dtds/podcast-1.0.dtd',
        }

        entries = []
        for it in doc.findall('./channel/item'):
            next_url = next(
                (e.attrib.get('url') for e in it.findall('./enclosure')),
                xpath_text(it, 'link', fatal=False))
            if not next_url:
                continue

            guid = try_call(lambda: it.find('guid').text)
            if guid:
                next_url = smuggle_url(next_url, {'force_videoid': guid})

            def itunes(key):
                return xpath_text(it, xpath_with_ns(f'./itunes:{key}', NS_MAP), default=None)

            entries.append({
                '_type': 'url_transparent',
                'url': next_url,
                'title': try_call(lambda: it.find('title').text),
                'description': xpath_text(it, 'description', default=None),