Python scraper based on AI
Python ai-crawlerai-scrapingai-searchcrawlerdata-extractionfirecrawl-alternativelarge-language-modelllmmarkdownragscrapingscraping-pythonweb-crawlerweb-crawlersweb-dataweb-data-extractionweb-scraperweb-scrapingweb-searchwebscraping
feat: refactoring of ScrapeGraph to SmartScraperLiteGraph
Marco Vinciguerra52b6bf5fb8c5
diff --git a/scrapegraphai/graphs/__init__.py b/scrapegraphai/graphs/__init__.pyindex 9c8bc820..2c75f0f7 100644--- a/scrapegraphai/graphs/__init__.py+++ b/scrapegraphai/graphs/__init__.py@@ -26,4 +26,4 @@ from .smart_scraper_multi_concat_graph import SmartScraperMultiConcatGraphfrom .code_generator_graph import CodeGeneratorGraphfrom .depth_search_graph import DepthSearchGraphfrom .smart_scraper_multi_lite_graph import SmartScraperMultiLiteGraph-from .scrape_graph import ScrapeGraph+from .smart_scraper_lite_graph import SmartScraperLiteGraphdiff --git a/scrapegraphai/graphs/scrape_graph.py b/scrapegraphai/graphs/smart_scraper_lite_graph.pysimilarity index 92%rename from scrapegraphai/graphs/scrape_graph.pyrename to scrapegraphai/graphs/smart_scraper_lite_graph.pyindex a08149aa..77437145 100644--- a/scrapegraphai/graphs/scrape_graph.py+++ b/scrapegraphai/graphs/smart_scraper_lite_graph.py@@ -10,9 +10,9 @@ from ..nodes import (ParseNode,)-class ScrapeGraph(AbstractGraph):+class SmartScraperLiteGraph(AbstractGraph):"""- ScrapeGraph is a scraping pipeline that automates the process of+ SmartScraperLiteGraph is a scraping pipeline that automates the process ofextracting information from web pages.Attributes:@@ -30,7 +30,7 @@ class ScrapeGraph(AbstractGraph):schema (BaseModel): The schema for the graph output.Example:- >>> scraper = ScraperGraph(+ >>> scraper = SmartScraperLiteGraph(... "https://en.wikipedia.org/wiki/Chioggia",... {"llm": {"model": "openai/gpt-3.5-turbo"}}... )@@ -38,7 +38,8 @@ class ScrapeGraph(AbstractGraph):)"""- def __init__(self, source: str, config: dict, prompt: str = "", schema: Optional[BaseModel] = None):+ def __init__(self, source: str, config: dict, prompt: str = "",+ schema: Optional[BaseModel] = None):super().__init__(prompt, config, source, schema)self.input_key = "url" if source.startswith("http") else "local_dir"diff --git a/scrapegraphai/graphs/smart_scraper_multi_lite_graph.py b/scrapegraphai/graphs/smart_scraper_multi_lite_graph.pyindex 14e576d9..bb17bd03 100644--- a/scrapegraphai/graphs/smart_scraper_multi_lite_graph.py+++ b/scrapegraphai/graphs/smart_scraper_multi_lite_graph.py@@ -6,7 +6,7 @@ from typing import List, Optionalfrom pydantic import BaseModelfrom .base_graph import BaseGraphfrom .abstract_graph import AbstractGraph-from .scrape_graph import ScrapeGraph+from .smart_scraper_lite_graph import SmartScraperLiteGraphfrom ..nodes import (GraphIteratorNode,MergeAnswersNode,@@ -63,7 +63,7 @@ class SmartScraperMultiLiteGraph(AbstractGraph):input="user_prompt & urls",output=["parsed_doc"],node_config={- "graph_instance": ScrapeGraph,+ "graph_instance": SmartScraperLiteGraph,"scraper_config": self.copy_config,},schema=self.copy_schema