Skip to content

Python scraper based on AI

refactoring of fetch node

Marco Vinciguerra2f02830c819a
diff --git a/examples/local_models/smart_scraper_ollama.py b/examples/local_models/smart_scraper_ollama.py
index ded6f308..aab77360 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/llama3",
+ "model": "ollama/mistral",
"temperature": 0,
"format": "json", # Ollama needs the format to be specified explicitly
# "base_url": "http://localhost:11434", # set ollama URL arbitrarily
diff --git a/examples/openai/smart_scraper_openai.py b/examples/openai/smart_scraper_openai.py
index bae4f688..7e147491 100644
--- a/examples/openai/smart_scraper_openai.py
+++ b/examples/openai/smart_scraper_openai.py
@@ -30,10 +30,9 @@ graph_config = {
# ************************************************
smart_scraper_graph = SmartScraperGraph(
- prompt="List me all the projects with their description",
- # also accepts a string with the already downloaded HTML code
- source="https://perinim.github.io/projects/",
- config=graph_config,
+ prompt="List me all the titles of the articles",
+ source="https://www.wired.com",
+ config=graph_config
)
result = smart_scraper_graph.run()
diff --git a/scrapegraphai/nodes/fetch_node.py b/scrapegraphai/nodes/fetch_node.py
index 71f69c36..f38cdfb9 100644
--- a/scrapegraphai/nodes/fetch_node.py
+++ b/scrapegraphai/nodes/fetch_node.py
@@ -170,7 +170,7 @@ class FetchNode(BaseNode):
parsed_content = convert_to_md(document[0].page_content)
compressed_document = [
- Document(page_content=parsed_content, metadata={"source": parsed_content})
+ Document(page_content=parsed_content, metadata={"source": "html file"})
]
state.update(