Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions scraping_scrapegraph_gemini.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from scrapegraphai.graphs import SmartScraperGraph
GOOGLE_APIKEY = "YOUR_API_KEY"

# Define the configuration for the graph
graph_config = {
"llm": {
"api_key": GOOGLE_APIKEY,
"model": "gemini-pro",
},
}

# Create the SmartScraperGraph instance
smart_scraper_graph = SmartScraperGraph(
prompt="List me all the quotes, authors and tags ",
file_source="http://quotes.toscrape.com", # also accepts a string with the already downloaded HTML code as string format
config=graph_config
)

result = smart_scraper_graph.run()
print(result)
20 changes: 20 additions & 0 deletions scraping_scrapegraph_openai.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from scrapegraphai.graphs import SmartScraperGraph
OPENAI_API_KEY = "YOUR_API_KEY"

# Define the configuration for the graph
graph_config = {
"llm": {
"api_key": OPENAI_API_KEY,
"model": "gpt-3.5-turbo",
},
}

# Create the SmartScraperGraph instance
smart_scraper_graph = SmartScraperGraph(
prompt="List me all the quotes, authors and tags ",
file_source="http://quotes.toscrape.com", # also accepts a string with the already downloaded HTML code as string format
config=graph_config
)

result = smart_scraper_graph.run()
print(result)