mirror of
https://github.com/VinciGit00/Scrapegraph-ai.git
synced 2026-07-01 21:00:48 +08:00
This commit is contained in:
parent
8aa9103f02
commit
209b4456fd
@ -44,7 +44,7 @@ dependencies = [
|
|||||||
"googlesearch-python>=1.2.5",
|
"googlesearch-python>=1.2.5",
|
||||||
"simpleeval>=1.0.0",
|
"simpleeval>=1.0.0",
|
||||||
"async_timeout>=4.0.3",
|
"async_timeout>=4.0.3",
|
||||||
"scrapegraph-py>=0.0.3"
|
"scrapegraph-py>=0.0.4"
|
||||||
]
|
]
|
||||||
|
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|||||||
@ -13,7 +13,7 @@ from ..nodes import (
|
|||||||
ConditionalNode
|
ConditionalNode
|
||||||
)
|
)
|
||||||
from ..prompts import REGEN_ADDITIONAL_INFO
|
from ..prompts import REGEN_ADDITIONAL_INFO
|
||||||
from scrapegraph_py import ScrapeGraphClient, smart_scraper
|
from scrapegraph_py import SyncClient
|
||||||
|
|
||||||
class SmartScraperGraph(AbstractGraph):
|
class SmartScraperGraph(AbstractGraph):
|
||||||
"""
|
"""
|
||||||
@ -61,10 +61,14 @@ class SmartScraperGraph(AbstractGraph):
|
|||||||
BaseGraph: A graph instance representing the web scraping workflow.
|
BaseGraph: A graph instance representing the web scraping workflow.
|
||||||
"""
|
"""
|
||||||
if self.llm_model == "scrapegraphai/smart-scraper":
|
if self.llm_model == "scrapegraphai/smart-scraper":
|
||||||
client = ScrapeGraphClient(self.config.get("api_key"))
|
|
||||||
|
|
||||||
result = smart_scraper(client, self.source, self.prompt)
|
sgai_client = SyncClient(api_key=self.config.get("api_key"))
|
||||||
return result
|
|
||||||
|
response = sgai_client.smartscraper(
|
||||||
|
website_url=self.source,
|
||||||
|
user_prompt=self.prompt
|
||||||
|
)
|
||||||
|
return response
|
||||||
|
|
||||||
fetch_node = FetchNode(
|
fetch_node = FetchNode(
|
||||||
input="url| local_dir",
|
input="url| local_dir",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user