pip install bleach
python
import bleach
def clean_html(input_html):
allowed_tags = ['p', 'strong', 'em', 'ul', 'li']
clean_html = bleach.clean(input_html, tags=allowed_tags, attributes={})
return clean_html
user_input = '<p>This is a <script>alert("XSS!")</script> test.</p>'
cleaned_html = clean_html(user_input)
print(cleaned_html)