Skip to content

Python scraper based on AI

feat: refactoring of ScrapeGraph to SmartScraperLiteGraph

Marco Vinciguerra52b6bf5fb8c5
diff --git a/scrapegraphai/graphs/__init__.py b/scrapegraphai/graphs/__init__.py
index 9c8bc820..2c75f0f7 100644
--- a/scrapegraphai/graphs/__init__.py
+++ b/scrapegraphai/graphs/__init__.py
@@ -26,4 +26,4 @@ from .smart_scraper_multi_concat_graph import SmartScraperMultiConcatGraph
from .code_generator_graph import CodeGeneratorGraph
from .depth_search_graph import DepthSearchGraph
from .smart_scraper_multi_lite_graph import SmartScraperMultiLiteGraph
-from .scrape_graph import ScrapeGraph
+from .smart_scraper_lite_graph import SmartScraperLiteGraph
diff --git a/scrapegraphai/graphs/scrape_graph.py b/scrapegraphai/graphs/smart_scraper_lite_graph.py
similarity index 92%
rename from scrapegraphai/graphs/scrape_graph.py
rename to scrapegraphai/graphs/smart_scraper_lite_graph.py
index 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 of
extracting 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.py
index 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, Optional
from pydantic import BaseModel
from .base_graph import BaseGraph
from .abstract_graph import AbstractGraph
-from .scrape_graph import ScrapeGraph
+from .smart_scraper_lite_graph import SmartScraperLiteGraph
from ..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