Skip to content

Commit 8fba7e5

Browse files
committed
feat(refactor): changed variable names
1 parent da2c82a commit 8fba7e5

13 files changed

+54
-52
lines changed

examples/gemini/json_scraper_gemini.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
"""
2-
Basic example of scraping pipeline using SmartScraper from JSON documents
2+
Basic example of scraping pipeline using JSONScraperGraph from JSON documents
33
"""
44

55
import os
66
from dotenv import load_dotenv
7-
from scrapegraphai.graphs import JsonScraperGraph
7+
from scrapegraphai.graphs import JSONScraperGraph
88
from scrapegraphai.utils import convert_to_csv, convert_to_json, prettify_exec_info
99
load_dotenv()
1010

@@ -33,23 +33,23 @@
3333
}
3434

3535
# ************************************************
36-
# Create the JsonScraperGraph instance and run it
36+
# Create the JSONScraperGraph instance and run it
3737
# ************************************************
3838

39-
smart_scraper_graph = JsonScraperGraph(
39+
json_scraper_graph = JSONScraperGraph(
4040
prompt="List me all the authors, title and genres of the books",
4141
source=text, # Pass the content of the file, not the file object
4242
config=graph_config
4343
)
4444

45-
result = smart_scraper_graph.run()
45+
result = json_scraper_graph.run()
4646
print(result)
4747

4848
# ************************************************
4949
# Get graph execution info
5050
# ************************************************
5151

52-
graph_exec_info = smart_scraper_graph.get_execution_info()
52+
graph_exec_info = json_scraper_graph.get_execution_info()
5353
print(prettify_exec_info(graph_exec_info))
5454

5555
# Save to json or csv

examples/gemini/xml_scraper_openai.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
"""
2-
Basic example of scraping pipeline using XmlScraperGraph from XML documents
2+
Basic example of scraping pipeline using XMLScraperGraph from XML documents
33
"""
44

55
import os
66
from dotenv import load_dotenv
7-
from scrapegraphai.graphs import XmlScraperGraph
7+
from scrapegraphai.graphs import XMLScraperGraph
88
from scrapegraphai.utils import convert_to_csv, convert_to_json, prettify_exec_info
99
load_dotenv()
1010

@@ -33,23 +33,23 @@
3333
}
3434

3535
# ************************************************
36-
# Create the XmlScraperGraph instance and run it
36+
# Create the XMLScraperGraph instance and run it
3737
# ************************************************
3838

39-
smart_scraper_graph = XmlScraperGraph(
39+
xml_scraper_graph = XMLScraperGraph(
4040
prompt="List me all the authors, title and genres of the books",
4141
source=text, # Pass the content of the file, not the file object
4242
config=graph_config
4343
)
4444

45-
result = smart_scraper_graph.run()
45+
result = xml_scraper_graph.run()
4646
print(result)
4747

4848
# ************************************************
4949
# Get graph execution info
5050
# ************************************************
5151

52-
graph_exec_info = smart_scraper_graph.get_execution_info()
52+
graph_exec_info = xml_scraper_graph.get_execution_info()
5353
print(prettify_exec_info(graph_exec_info))
5454

5555
# Save to json or csv

examples/local_models/Docker/json_scraper_docker.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
"""
2-
Basic example of scraping pipeline using JsonScraperGraph from JSON documents
2+
Basic example of scraping pipeline using JSONScraperGraph from JSON documents
33
"""
44

55
import os
66
from dotenv import load_dotenv
7-
from scrapegraphai.graphs import JsonScraperGraph
7+
from scrapegraphai.graphs import JSONScraperGraph
88
from scrapegraphai.utils import convert_to_csv, convert_to_json, prettify_exec_info
99
load_dotenv()
1010

@@ -37,23 +37,23 @@
3737
}
3838

3939
# ************************************************
40-
# Create the JsonScraperGraph instance and run it
40+
# Create the JSONScraperGraph instance and run it
4141
# ************************************************
4242

43-
smart_scraper_graph = JsonScraperGraph(
43+
json_scraper_graph = JSONScraperGraph(
4444
prompt="List me all the authors, title and genres of the books",
4545
source=text, # Pass the content of the file, not the file object
4646
config=graph_config
4747
)
4848

49-
result = smart_scraper_graph.run()
49+
result = json_scraper_graph.run()
5050
print(result)
5151

5252
# ************************************************
5353
# Get graph execution info
5454
# ************************************************
5555

56-
graph_exec_info = smart_scraper_graph.get_execution_info()
56+
graph_exec_info = json_scraper_graph.get_execution_info()
5757
print(prettify_exec_info(graph_exec_info))
5858

5959
# Save to json or csv

examples/local_models/Docker/xml_scraper_docker.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
"""
2-
Basic example of scraping pipeline using XmlScraperGraph from XML documents
2+
Basic example of scraping pipeline using XMLScraperGraph from XML documents
33
"""
44

55
import os
66
from dotenv import load_dotenv
7-
from scrapegraphai.graphs import XmlScraperGraph
7+
from scrapegraphai.graphs import XMLScraperGraph
88
from scrapegraphai.utils import convert_to_csv, convert_to_json, prettify_exec_info
99
load_dotenv()
1010

@@ -37,23 +37,23 @@
3737
}
3838

3939
# ************************************************
40-
# Create the XmlScraperGraph instance and run it
40+
# Create the XMLScraperGraph instance and run it
4141
# ************************************************
4242

43-
smart_scraper_graph = XmlScraperGraph(
43+
xml_scraper_graph = XMLScraperGraph(
4444
prompt="List me all the authors, title and genres of the books",
4545
source=text, # Pass the content of the file, not the file object
4646
config=graph_config
4747
)
4848

49-
result = smart_scraper_graph.run()
49+
result = xml_scraper_graph.run()
5050
print(result)
5151

5252
# ************************************************
5353
# Get graph execution info
5454
# ************************************************
5555

56-
graph_exec_info = smart_scraper_graph.get_execution_info()
56+
graph_exec_info = xml_scraper_graph.get_execution_info()
5757
print(prettify_exec_info(graph_exec_info))
5858

5959
# Save to json or csv

examples/local_models/Ollama/json_scraper_ollama.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
"""
2-
Basic example of scraping pipeline using JsonScraperGraph from JSON documents
2+
Basic example of scraping pipeline using JSONScraperGraph from JSON documents
33
"""
44

55
import os
66
from dotenv import load_dotenv
7-
from scrapegraphai.graphs import JsonScraperGraph
7+
from scrapegraphai.graphs import JSONScraperGraph
88
from scrapegraphai.utils import convert_to_csv, convert_to_json, prettify_exec_info
99
load_dotenv()
1010

@@ -39,23 +39,23 @@
3939
}
4040

4141
# ************************************************
42-
# Create the XmlScraperGraph instance and run it
42+
# Create the JSONScraperGraph instance and run it
4343
# ************************************************
4444

45-
smart_scraper_graph = JsonScraperGraph(
45+
json_scraper_graph = JSONScraperGraph(
4646
prompt="List me all the authors, title and genres of the books",
4747
source=text, # Pass the content of the file, not the file object
4848
config=graph_config
4949
)
5050

51-
result = smart_scraper_graph.run()
51+
result = json_scraper_graph.run()
5252
print(result)
5353

5454
# ************************************************
5555
# Get graph execution info
5656
# ************************************************
5757

58-
graph_exec_info = smart_scraper_graph.get_execution_info()
58+
graph_exec_info = json_scraper_graph.get_execution_info()
5959
print(prettify_exec_info(graph_exec_info))
6060

6161
# Save to json or csv

examples/local_models/Ollama/xml_scraper_ollama.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
"""
2-
Basic example of scraping pipeline using XmlScraperGraph from XML documents
2+
Basic example of scraping pipeline using XMLScraperGraph from XML documents
33
"""
44

55
import os
66
from dotenv import load_dotenv
7-
from scrapegraphai.graphs import XmlScraperGraph
7+
from scrapegraphai.graphs import XMLScraperGraph
88
from scrapegraphai.utils import convert_to_csv, convert_to_json, prettify_exec_info
99
load_dotenv()
1010

@@ -39,23 +39,23 @@
3939
}
4040

4141
# ************************************************
42-
# Create the XmlScraperGraph instance and run it
42+
# Create the XMLScraperGraph instance and run it
4343
# ************************************************
4444

45-
smart_scraper_graph = XmlScraperGraph(
45+
xml_scraper_graph = XMLScraperGraph(
4646
prompt="List me all the authors, title and genres of the books",
4747
source=text, # Pass the content of the file, not the file object
4848
config=graph_config
4949
)
5050

51-
result = smart_scraper_graph.run()
51+
result = xml_scraper_graph.run()
5252
print(result)
5353

5454
# ************************************************
5555
# Get graph execution info
5656
# ************************************************
5757

58-
graph_exec_info = smart_scraper_graph.get_execution_info()
58+
graph_exec_info = xml_scraper_graph.get_execution_info()
5959
print(prettify_exec_info(graph_exec_info))
6060

6161
# Save to json or csv

examples/local_models/result.json

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"projects": [{"title": "Rotary Pendulum RL", "description": "Open Source project aimed at controlling a real life rotary pendulum using RL algorithms"}, {"title": "DQN Implementation from scratch", "description": "Developed a Deep Q-Network algorithm to train a simple and double pendulum"}, {"title": "Multi Agents HAED", "description": "University project which focuses on simulating a multi-agent system to perform environment mapping. Agents, equipped with sensors, explore and record their surroundings, considering uncertainties in their readings."}, {"title": "Wireless ESC for Modular Drones", "description": "Modular drone architecture proposal and proof of concept. The project received maximum grade."}]}

examples/openai/json_scraper_openai.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
"""
2-
Basic example of scraping pipeline using JsonScraperGraph from JSON documents
2+
Basic example of scraping pipeline using JSONScraperGraph from JSON documents
33
"""
44

55
import os
66
from dotenv import load_dotenv
7-
from scrapegraphai.graphs import JsonScraperGraph
7+
from scrapegraphai.graphs import JSONScraperGraph
88
from scrapegraphai.utils import convert_to_csv, convert_to_json, prettify_exec_info
99
load_dotenv()
1010

@@ -33,23 +33,23 @@
3333
}
3434

3535
# ************************************************
36-
# Create the XmlScraperGraph instance and run it
36+
# Create the JSONScraperGraph instance and run it
3737
# ************************************************
3838

39-
smart_scraper_graph = JsonScraperGraph(
39+
json_scraper_graph = JSONScraperGraph(
4040
prompt="List me all the authors, title and genres of the books",
4141
source=text, # Pass the content of the file, not the file object
4242
config=graph_config
4343
)
4444

45-
result = smart_scraper_graph.run()
45+
result = json_scraper_graph.run()
4646
print(result)
4747

4848
# ************************************************
4949
# Get graph execution info
5050
# ************************************************
5151

52-
graph_exec_info = smart_scraper_graph.get_execution_info()
52+
graph_exec_info = json_scraper_graph.get_execution_info()
5353
print(prettify_exec_info(graph_exec_info))
5454

5555
# Save to json or csv

examples/openai/result.json

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"top_5_eyeliner_products_for_gift": [{"product_name": "Tarte Double Take Eyeliner", "type": "Liquid, Gel", "price": "$26", "link": "https://www.sephora.com/product/double-take-eyeliner-P421701"}, {"product_name": "AppleDoll Velvet Liner", "type": "Liquid", "price": "$22", "link": "https://www.appledoll.com/products/velvet-liner"}, {"product_name": "Rare Beauty Perfect Strokes Gel Eyeliner", "type": "Gel", "price": "$19", "link": "https://www.sephora.com/product/perfect-strokes-gel-eyeliner-P468000"}, {"product_name": "Laura Mercier Caviar Tightline Eyeliner", "type": "Gel", "price": "$29", "link": "https://www.sephora.com/product/caviar-tightline-eyeliner-P448800"}, {"product_name": "Ilia Clean Line Liquid Eyeliner", "type": "Liquid", "price": "$28", "link": "https://www.amazon.com/ILIA-Clean-Line-Liquid-Eyeliner/dp/B08Z7JZQZP"}, {"brand": "Tom Ford", "product_name": "Eye Defining Pen", "price": "$62", "type": "Liquid", "colors": 1, "retailer": "Nordstrom"}, {"brand": "Fenty Beauty", "product_name": "Flyliner", "price": "$24", "type": "Liquid", "colors": 2, "retailer": "Sephora"}, {"brand": "Lanc\u00f4me", "product_name": "Le Crayon Kh\u00f4l Smoky Eyeliner", "price": "$28", "type": "Kohl", "colors": 2, "retailer": "Macy's"}, {"brand": "Jillian Dempsey", "product_name": "Kh\u00f4l Eyeliner", "price": "$20", "type": "Kohl", "colors": 6, "retailer": "Amazon"}, {"brand": "R\u00f3en", "product_name": "Eyeline Define Eyeliner Pencil", "price": "$26", "type": "Kohl", "colors": 4, "retailer": "Credo Beauty"}]}

examples/openai/xml_scraper_openai.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
"""
2-
Basic example of scraping pipeline using XmlScraperGraph from XML documents
2+
Basic example of scraping pipeline using XMLScraperGraph from XML documents
33
"""
44

55
import os
66
from dotenv import load_dotenv
7-
from scrapegraphai.graphs import XmlScraperGraph
7+
from scrapegraphai.graphs import XMLScraperGraph
88
from scrapegraphai.utils import convert_to_csv, convert_to_json, prettify_exec_info
99
load_dotenv()
1010

@@ -33,23 +33,23 @@
3333
}
3434

3535
# ************************************************
36-
# Create the XmlScraperGraph instance and run it
36+
# Create the XMLScraperGraph instance and run it
3737
# ************************************************
3838

39-
smart_scraper_graph = XmlScraperGraph(
39+
xml_scraper_graph = XMLScraperGraph(
4040
prompt="List me all the authors, title and genres of the books",
4141
source=text, # Pass the content of the file, not the file object
4242
config=graph_config
4343
)
4444

45-
result = smart_scraper_graph.run()
45+
result = xml_scraper_graph.run()
4646
print(result)
4747

4848
# ************************************************
4949
# Get graph execution info
5050
# ************************************************
5151

52-
graph_exec_info = smart_scraper_graph.get_execution_info()
52+
graph_exec_info = xml_scraper_graph.get_execution_info()
5353
print(prettify_exec_info(graph_exec_info))
5454

5555
# Save to json or csv

scrapegraphai/graphs/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66
from .speech_graph import SpeechGraph
77
from .search_graph import SearchGraph
88
from .script_creator_graph import ScriptCreatorGraph
9-
from .xml_scraper_graph import XmlScraperGraph
10-
from .json_scraper_graph import JsonScraperGraph
9+
from .xml_scraper_graph import XMLScraperGraph
10+
from .json_scraper_graph import JSONScraperGraph

scrapegraphai/graphs/json_scraper_graph.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from .abstract_graph import AbstractGraph
1212

1313

14-
class JsonScraperGraph(AbstractGraph):
14+
class JSONScraperGraph(AbstractGraph):
1515
"""
1616
SmartScraper is a comprehensive web scraping tool that automates the process of extracting
1717
information from web pages using a natural language model to interpret and answer prompts.

scrapegraphai/graphs/xml_scraper_graph.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from .abstract_graph import AbstractGraph
1212

1313

14-
class XmlScraperGraph(AbstractGraph):
14+
class XMLScraperGraph(AbstractGraph):
1515
"""
1616
SmartScraper is a comprehensive web scraping tool that automates the process of extracting
1717
information from web pages using a natural language model to interpret and answer prompts.

0 commit comments

Comments
 (0)