# import wmill
from bs4 import BeautifulSoup
def main(html: str, css_selector: str = ""):
if not css_selector:
return {"text": html}
else:
soup = BeautifulSoup(html, "html.parser")
matches = [el.get_text() for el in soup.select(css_selector)]
return {"text": "\n\n".join(matches), "matches": len(matches)}
Submitted by marco lussetti774 547 days ago