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

Code before:
        type_test = lambda val: try_call(expected_type, args=(val,))
    else:
        type_test = IDENTITY

    is_sequence = lambda x: isinstance(x, collections.abc.Sequence) and not isinstance(x, str)

    def _traverse_obj(start_obj, path):
        has_branched, results = _traverse_path(start_obj, path)
        if results:
            if get_all and has_branched:
                return list(map(type_test, results))
            else:
                return type_test(results[0])
        return None

    def _traverse_path(start_obj, path):
        path = tuple(variadic(path))
        objs = [start_obj]
        has_branched = False

        result_objs = []
        for key in path:
            if not objs:
                return has_branched, result_objs

            if is_user_input and key == ":":
                key = ...

            if not casesense and isinstance(key, str):
                key = key.casefold()

            result_objs.clear()
            for obj in objs:
                if key is None:
                    result_objs.append(obj)
                    continue
                elif obj is None:
                    continue

                if isinstance(key, (list, tuple)):
                    has_branched = True
                    for branch in key:
                        _, result = _traverse_path(obj, branch)
                        result_objs.extend(result)

                elif key is ...:
                    has_branched = True
                    if isinstance(obj, collections.abc.Mapping):
                        result_objs.extend(obj.values())
                    elif is_sequence(obj):
                        result_objs.extend(obj)

Review comment (suggestion):
```suggestion
            if is_user_input and key == ':':
```

Code after:

    def apply_key(key, obj):
        if obj is None:
            return

        elif key is None:
            yield obj

        elif isinstance(key, (list, tuple)):
            for branch in key:
                _, result = apply_path(obj, branch)
                yield from result

        elif key is ...:
            if isinstance(obj, collections.abc.Mapping):
                yield from obj.values()
            elif is_sequence(obj):
                yield from obj
            elif traverse_string:
                yield from str(obj)

        elif callable(key):
            if is_sequence(obj):
                iter_obj = enumerate(obj)
            elif isinstance(obj, collections.abc.Mapping):
                iter_obj = obj.items()
            elif traverse_string:
                iter_obj = enumerate(str(obj))
            else:
                return
            yield from (v for k, v in iter_obj if try_call(key, args=(k, v)))

        elif isinstance(key, dict):
            iter_obj = ((k, _traverse_obj(obj, v)) for k, v in key.items())
            yield {k: v if v is not None else default for k, v in iter_obj
                   if v is not None or default is not None}

        elif isinstance(obj, dict):
            yield (obj.get(key) if casesense or (key in obj)
                   else next((v for k, v in obj.items() if casefold(k) == key), None))

        else:
            if is_user_input:
                key = (int_or_none(key) if ':' not in key
                       else slice(*map(int_or_none, key.split(':'))))

            if not isinstance(key, (int, slice)):
                return

            if not is_sequence(obj):
                if not traverse_string: