Skip to content

Python scraper based on AI

feat:expose the search engine params to user

smith peng8422463ca6d5
diff --git a/scrapegraphai/graphs/omni_search_graph.py b/scrapegraphai/graphs/omni_search_graph.py
index c005dbac..860685bd 100644
--- a/scrapegraphai/graphs/omni_search_graph.py
+++ b/scrapegraphai/graphs/omni_search_graph.py
@@ -83,7 +83,8 @@ class OmniSearchGraph(AbstractGraph):
output=["urls"],
node_config={
"llm_model": self.llm_model,
- "max_results": self.max_results
+ "max_results": self.max_results,
+ "search_engine": self.copy_config.get("search_engine")
}
)
graph_iterator_node = GraphIteratorNode(
diff --git a/scrapegraphai/graphs/search_graph.py b/scrapegraphai/graphs/search_graph.py
index d27e7186..e34469be 100644
--- a/scrapegraphai/graphs/search_graph.py
+++ b/scrapegraphai/graphs/search_graph.py
@@ -76,7 +76,8 @@ class SearchGraph(AbstractGraph):
output=["urls"],
node_config={
"llm_model": self.llm_model,
- "max_results": self.max_results
+ "max_results": self.max_results,
+ "search_engine": self.copy_config.get("search_engine")
}
)
graph_iterator_node = GraphIteratorNode(
diff --git a/scrapegraphai/nodes/search_internet_node.py b/scrapegraphai/nodes/search_internet_node.py
index df1b6277..14ce3207 100644
--- a/scrapegraphai/nodes/search_internet_node.py
+++ b/scrapegraphai/nodes/search_internet_node.py
@@ -41,7 +41,11 @@ class SearchInternetNode(BaseNode):
self.verbose = (
False if node_config is None else node_config.get("verbose", False)
)
- self.search_engine = node_config.get("search_engine", "google")
+ self.search_engine = (
+ node_config["search_engine"]
+ if node_config.get("search_engine")
+ else "google"
+ )
self.max_results = node_config.get("max_results", 3)
def execute(self, state: dict) -> dict: