def preprocessor(dom):
    "Removes unwanted parts of DOM."
    options = {
        "processing_instructions": False,
        "remove_unknown_tags": False,
        "safe_attrs_only": False,
        "page_structure": False,
        "annoying_tags": False,
        "frames": False,
        "meta": False,
        "links": False,
        "javascript": False,
        "scripts": True,
        "comments": True,
        "style": True,
        "embedded": True,
        "forms": True,
        "kill_tags": ("head",),
    }
    cleaner = Cleaner(**options)

    return cleaner.clean_html(dom)
def preprocessor ( dom ) : options = { "processing_instructions" : False , "remove_unknown_tags" : False , "safe_attrs_only" : False , "page_structure" : False , "annoying_tags" : False , "frames" : False , "meta" : False , "links" : False , "javascript" : False , "scripts" : True , "comments" : True , "style" : True , "embedded" : True , "forms" : True , "kill_tags" : ( "head" , ) , } cleaner = Cleaner ( ** options ) return cleaner . clean_html ( dom )
Removes unwanted parts of DOM.