Skip to main content

TextFromHTML

This Script is part of the Common Scripts Pack.#

Extract regular text from the given HTML

Script Data#


NameDescription
Script Typepython3
TagsUtility
Cortex XSOAR Version5.0.0

Inputs#


Argument NameDescription
htmlThe HTML to strip tags from.
html_tagSpecify the HTML tag to extract the text from within.
allow_body_fallbackAllow using the input HTML as a fallback for the body, if no body tag is found. This only applies, if html_tag is set to body.
replace_line_breaksReplace `br` in `html` with linebreaks in the output.
trim_resultTrim the extracted result. When set to true, leading and trailing whitespaces are removed and blocks of more than 3 consecutive whitespaces are collapsed to two.
output_to_contextStore the extracted text in context.

Outputs#


PathDescriptionType
TextFromHTMLThe Text extracted from the given HTML.string

Script Examples#

Example command#

!TextFromHTML html="<!DOCTYPE html><html><body><h1>This is heading 1</h1></body></html>"

Context Example#

{}

Human Readable Output#

This is heading 1