Extract text from HTML, removing all tags.
(html: str)
| 213 | |
| 214 | |
| 215 | def extract_text_from_html(html: str) -> str: |
| 216 | """Extract text from HTML, removing all tags.""" |
| 217 | if not html: |
| 218 | return "" |
| 219 | |
| 220 | # Remove script and style elements |
| 221 | clean_html = re.sub(r'<(script|style)[^>]*>.*?</\1>', '', html, flags=re.DOTALL) |
| 222 | # Remove all other tags |
| 223 | clean_text = re.sub(r'<[^>]+>', '', clean_html).strip() |
| 224 | return clean_text |
| 225 | |
| 226 | def extract_url_params_to_dict(url: str) -> Dict: |
| 227 | """Extract URL parameters to dict""" |
no outgoing calls
no test coverage detected