Python scraper based on AI
Python ai-crawlerai-scrapingai-searchcrawlerdata-extractionfirecrawl-alternativelarge-language-modelllmmarkdownragscrapingscraping-pythonweb-crawlerweb-crawlersweb-dataweb-data-extractionweb-scraperweb-scrapingweb-searchwebscraping
remove link from markdown
Matteo Vedovati015c6fd90504
diff --git a/scrapegraphai/nodes/fetch_node_level_k.py b/scrapegraphai/nodes/fetch_node_level_k.pyindex ff329a39..5cdd6571 100644--- a/scrapegraphai/nodes/fetch_node_level_k.py+++ b/scrapegraphai/nodes/fetch_node_level_k.py@@ -95,8 +95,6 @@ class FetchNodeLevelK(BaseNode):documents = [{"source": source}]- self.logger.info(f"--- (Fetching HTML from: {source}) ---")-loader_kwargs = {}if self.node_config is not None:@@ -112,6 +110,8 @@ class FetchNodeLevelK(BaseNode):return statedef fetch_content(self, source: str, loader_kwargs) -> Optional[str]:+ self.logger.info(f"--- (Fetching HTML from: {source}) ---")+if self.browser_base is not None:try:from ..docloaders.browser_base import browser_base_fetch@@ -159,9 +159,10 @@ class FetchNodeLevelK(BaseNode):documents.remove(doc)continue- doc['document'] = document[0].page_content+ #doc['document'] = document[0].page_content+ doc['document'] = document- links = self.extract_links(doc['document'])+ links = self.extract_links(doc['document'][0].page_content)full_links = self.get_full_links(source, links)# Check if the links are already present in other documentsdiff --git a/scrapegraphai/nodes/parse_node_depth_k.py b/scrapegraphai/nodes/parse_node_depth_k.pyindex 30afa23c..7b7ab194 100644--- a/scrapegraphai/nodes/parse_node_depth_k.py+++ b/scrapegraphai/nodes/parse_node_depth_k.py@@ -5,6 +5,7 @@ import refrom typing import List, Optional, Tuplefrom .base_node import BaseNodefrom ..utils.convert_to_md import convert_to_md+from langchain_community.document_transformers import Html2TextTransformerclass ParseNodeDepthK(BaseNode):"""@@ -62,8 +63,9 @@ class ParseNodeDepthK(BaseNode):documents = input_data[0]for doc in documents:- document_md = convert_to_md(doc["document"])- doc["document_md"] = document_md+ document_md = Html2TextTransformer(ignore_links=True).transform_documents(doc["document"])+ #document_md = convert_to_md(doc["document"])+ doc["document"] = document_md[0].page_contentstate.update({self.output[0]: documents})