def strip_html(html: str) -> str:
    """
    Simplify an HTML string.

    Will remove unwanted elements, attributes, and redundant content
    Args:
        html (str): The input HTML string.

    Returns:
        str: The cleaned and simplified HTML string.

    """
    cleaned_html = clean_html(html)
    html_tree = fromstring(cleaned_html)

    for element in html_tree.iter():
        if "style" in element.attrib:
            del element.attrib["style"]

        if (
            (
                not element.attrib
                or (len(element.attrib) == 1 and "idx" in element.attrib)
            )
            and not element.getchildren()  # type: ignore[attr-defined]
            and (not element.text or not element.text.strip())
            and (not element.tail or not element.tail.strip())
        ):
            parent = element.getparent()
            if parent is not None:
                parent.remove(element)

    xpath_query = (
        ".//*[contains(@class, 'footer') or contains(@id, 'footer') or "
        "contains(@class, 'hidden') or contains(@id, 'hidden')]"
    )
    elements_to_remove = html_tree.xpath(xpath_query)
    for element in elements_to_remove:  # type: ignore[assignment, union-attr]
        parent = element.getparent()
        if parent is not None:
            parent.remove(element)

    stripped_html = tostring(html_tree, encoding="unicode")
    stripped_html = re.sub(r"\s{2,}", " ", stripped_html)
    return re.sub(r"\n{2,}", "", stripped_html)

    Simplify an HTML string.

    Will remove unwanted elements, attributes, and redundant content
    Args:
        html (str): The input HTML string.

    Returns:
        str: The cleaned and simplified HTML string.

    
llama-index-integrations/readers/llama-index-readers-web/llama_index/readers/web/oxylabs_web/utils.py