Skip to content

Python scraper based on AI

fixed a bug

Marco Vinciguerra23bc6332d04b
diff --git a/examples/local_models/smart_scraper_ollama.py b/examples/local_models/smart_scraper_ollama.py
index 13fd7d12..ded6f308 100644
--- a/examples/local_models/smart_scraper_ollama.py
+++ b/examples/local_models/smart_scraper_ollama.py
@@ -9,7 +9,7 @@ from scrapegraphai.utils import prettify_exec_info
graph_config = {
"llm": {
- "model": "ollama/mistral",
+ "model": "ollama/llama3",
"temperature": 0,
"format": "json", # Ollama needs the format to be specified explicitly
# "base_url": "http://localhost:11434", # set ollama URL arbitrarily
@@ -29,8 +29,7 @@ graph_config = {
smart_scraper_graph = SmartScraperGraph(
prompt="List me all the titles of the articles",
- # also accepts a string with the already downloaded HTML code
- source="https://www.wired.com/",
+ source="https://www.wired.com",
config=graph_config
)
diff --git a/examples/local_models/smart_scraper_schema_ollama.py b/examples/local_models/smart_scraper_schema_ollama.py
index 5c7aa03f..7168d513 100644
--- a/examples/local_models/smart_scraper_schema_ollama.py
+++ b/examples/local_models/smart_scraper_schema_ollama.py
@@ -19,7 +19,7 @@ class Projects(BaseModel):
graph_config = {
"llm": {
- "model": "ollama/mistral",
+ "model": "ollama/llama3",
"temperature": 0,
"format": "json", # Ollama needs the format to be specified explicitly
# "base_url": "http://localhost:11434", # set ollama URL arbitrarily
diff --git a/scrapegraphai/nodes/fetch_node.py b/scrapegraphai/nodes/fetch_node.py
index 79c83364..71f69c36 100644
--- a/scrapegraphai/nodes/fetch_node.py
+++ b/scrapegraphai/nodes/fetch_node.py
@@ -167,10 +167,10 @@ class FetchNode(BaseNode):
if not document or not document[0].page_content.strip():
raise ValueError("No HTML body content found in the document fetched by ChromiumLoader.")
- parsed_content = convert_to_md(source)
+ parsed_content = convert_to_md(document[0].page_content)
compressed_document = [
- Document(page_content=parsed_content, metadata={"source": source})
+ Document(page_content=parsed_content, metadata={"source": parsed_content})
]
state.update(