Python scraper based on AI
Python ai-crawlerai-scrapingai-searchcrawlerdata-extractionfirecrawl-alternativelarge-language-modelllmmarkdownragscrapingscraping-pythonweb-crawlerweb-crawlersweb-dataweb-data-extractionweb-scraperweb-scrapingweb-searchwebscraping
fixing json and example
VinciGit00deb920a33ec0
diff --git a/examples/openai/result.json b/examples/openai/result.jsonnew file mode 100644index 00000000..b5e82a18--- /dev/null+++ b/examples/openai/result.json@@ -0,0 +1 @@+{"books": [{"title": "XML Developer's Guide", "author": "Unknown", "genre": "Unknown"}]}\ No newline at end of filediff --git a/scrapegraphai/graphs/json_scraper_graph.py b/scrapegraphai/graphs/json_scraper_graph.pyindex 456f5e56..d6287d2b 100644--- a/scrapegraphai/graphs/json_scraper_graph.py+++ b/scrapegraphai/graphs/json_scraper_graph.py@@ -30,7 +30,7 @@ class JsonScraperGraph(AbstractGraph):Creates the graph of nodes representing the workflow for web scraping."""fetch_node = FetchNode(- input="json | json_dir",+ input="json_dir",output=["doc"],)parse_node = ParseNode(diff --git a/scrapegraphai/graphs/xml_scraper_graph.py b/scrapegraphai/graphs/xml_scraper_graph.pyindex 07e407ce..1661113d 100644--- a/scrapegraphai/graphs/xml_scraper_graph.py+++ b/scrapegraphai/graphs/xml_scraper_graph.py@@ -30,7 +30,7 @@ class XmlScraperGraph(AbstractGraph):Creates the graph of nodes representing the workflow for web scraping."""fetch_node = FetchNode(- input="xml | xml_dir",+ input="xml_dir",output=["doc"],)parse_node = ParseNode(diff --git a/scrapegraphai/nodes/fetch_node.py b/scrapegraphai/nodes/fetch_node.pyindex 76d80929..9b6cb52f 100644--- a/scrapegraphai/nodes/fetch_node.py+++ b/scrapegraphai/nodes/fetch_node.py@@ -70,9 +70,12 @@ class FetchNode(BaseNode):input_data = [state[key] for key in input_keys]source = input_data[0]-+ if self.input == "json_dir" or self.input == "xml_dir":+ compressed_document = [Document(page_content=source, metadata={+ "source": "local_dir"+ })]# if it is a local directory- if not source.startswith("http"):+ elif not source.startswith("http"):compressed_document = [Document(page_content=remover(source), metadata={"source": "local_dir"})]