Python scraper based on AI
Python ai-crawlerai-scrapingai-searchcrawlerdata-extractionfirecrawl-alternativelarge-language-modelllmmarkdownragscrapingscraping-pythonweb-crawlerweb-crawlersweb-dataweb-data-extractionweb-scraperweb-scrapingweb-searchwebscraping
feat: update logs
Marco Vinciguerra8c5416208795
diff --git a/scrapegraphai/__init__.py b/scrapegraphai/__init__.pyindex 13eb6e85..4136a158 100644--- a/scrapegraphai/__init__.py+++ b/scrapegraphai/__init__.py@@ -6,4 +6,3 @@ from .utils.logging import get_logger, set_verbosity_infologger = get_logger(__name__)set_verbosity_info()-logger.info("This is an open-source library. If you want proxy rotations, residential proxies and faster inference times visit https://scrapegraphai.com")diff --git a/scrapegraphai/graphs/abstract_graph.py b/scrapegraphai/graphs/abstract_graph.pyindex 90f6efc2..d143dae2 100644--- a/scrapegraphai/graphs/abstract_graph.py+++ b/scrapegraphai/graphs/abstract_graph.py@@ -5,6 +5,7 @@ AbstractGraph Moduleimport asyncioimport uuidimport warnings+import timefrom abc import ABC, abstractmethodfrom typing import Optional, Type@@ -14,8 +15,13 @@ from pydantic import BaseModelfrom ..helpers import models_tokensfrom ..models import CLoD, DeepSeek, OneApi, XAI-from ..utils.logging import set_verbosity_info, set_verbosity_warning+from ..utils.logging import set_verbosity_info, set_verbosity_warning, get_logger+from ..telemetry import log_graph_execution+logger = get_logger(__name__)++# ANSI escape sequence for hyperlink+CLICKABLE_URL = "\033]8;;https://scrapegraphai.com\033\\https://scrapegraphai.com\033]8;;\033\\"class AbstractGraph(ABC):"""@@ -316,6 +322,10 @@ class AbstractGraph(ABC):"""Abstract method to execute the graph and return the result."""+ inputs = {"user_prompt": self.prompt, self.input_key: self.source}+ self.final_state, self.execution_info = self.graph.execute(inputs)+ result = self.final_state.get("answer", "No answer found.")+ return resultasync def run_safe_async(self) -> str:"""diff --git a/scrapegraphai/graphs/base_graph.py b/scrapegraphai/graphs/base_graph.pyindex 6021f97f..dad3a257 100644--- a/scrapegraphai/graphs/base_graph.py+++ b/scrapegraphai/graphs/base_graph.py@@ -8,7 +8,12 @@ from typing import Tuplefrom ..telemetry import log_graph_executionfrom ..utils import CustomLLMCallbackManager+from ..utils.logging import get_logger+logger = get_logger(__name__)++# ANSI escape sequence for hyperlink+CLICKABLE_URL = "\033]8;;https://scrapegraphai.com\033\\https://scrapegraphai.com\033]8;;\033\\"class BaseGraph:"""@@ -353,9 +358,24 @@ class BaseGraph:bridge = BurrBridge(self, self.burr_config)result = bridge.execute(initial_state)- return (result["_state"], [])+ state, exec_info = (result["_state"], [])else:- return self._execute_standard(initial_state)+ state, exec_info = self._execute_standard(initial_state)++ # Print the result first+ if "answer" in state:+ print(state["answer"])+ elif "parsed_doc" in state:+ print(state["parsed_doc"])+ elif "generated_code" in state:+ print(state["generated_code"])+ elif "merged_script" in state:+ print(state["merged_script"])++ # Then show the message ONLY ONCE+ print(f"✨ Try enhanced version of ScrapegraphAI at {CLICKABLE_URL} ✨")++ return state, exec_infodef append_node(self, node):"""diff --git a/uv.lock b/uv.lockindex fd5fc1e5..51274d45 100644--- a/uv.lock+++ b/uv.lock@@ -3446,7 +3446,7 @@ wheels = [[[package]]name = "scrapegraphai"-version = "1.54.0"+version = "1.54.1"source = { editable = "." }dependencies = [{ name = "async-timeout", version = "4.0.3", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.12'" },