Python scraper based on AI
Python ai-crawlerai-scrapingai-searchcrawlerdata-extractionfirecrawl-alternativelarge-language-modelllmmarkdownragscrapingscraping-pythonweb-crawlerweb-crawlersweb-dataweb-data-extractionweb-scraperweb-scrapingweb-searchwebscraping
Update remover.py
Marco Vinciguerra4703a0b94cbe
diff --git a/scrapegraphai/utils/remover.py b/scrapegraphai/utils/remover.pyindex 712b3f78..5b4ff83e 100644--- a/scrapegraphai/utils/remover.py+++ b/scrapegraphai/utils/remover.py@@ -7,8 +7,9 @@ from minify_html import minifydef remover(html_content: str) -> str:"""- This function processes HTML content, removes unnecessary tags,- minifies the HTML, and retrieves the title and body content.+ This function processes HTML content, removes unnecessary tags+ (including style tags), minifies the HTML, and retrieves the+ title and body content.Parameters:html_content (str): The HTML content to parse@@ -23,14 +24,16 @@ def remover(html_content: str) -> str:title_tag = soup.find('title')title = title_tag.get_text() if title_tag else ""- # Script Tag Removal- [script.extract() for script in soup.find_all('script')]+ # Script and Style Tag Removal+ for tag in soup.find_all(['script', 'style']):+ tag.extract()# Body Extraction (if it exists)body_content = soup.find('body')if body_content:# Minify the HTML within the body tagminimized_body = minify(str(body_content))- return "Title: " + title + ", Body: " + minimized_body+ return "Title: " + title + ", Body: " + minimized_bodyelse:- return "Title: " + title + ", Body: No body content found"+ return "Title: " + title + ", Body: No body content found"+