mirror of
https://github.com/VinciGit00/Scrapegraph-ai.git
synced 2026-06-12 21:01:54 +08:00
44 lines
1.1 KiB
Python
44 lines
1.1 KiB
Python
"""
|
|
This example shows how to do not process the html code in the fetch phase
|
|
"""
|
|
|
|
import json
|
|
|
|
from scrapegraphai.graphs import SmartScraperGraph
|
|
from scrapegraphai.utils import prettify_exec_info
|
|
|
|
# ************************************************
|
|
# Define the configuration for the graph
|
|
# ************************************************
|
|
|
|
|
|
graph_config = {
|
|
"llm": {
|
|
"api_key": "s",
|
|
"model": "openai/gpt-3.5-turbo",
|
|
},
|
|
"cut": False,
|
|
"verbose": True,
|
|
"headless": False,
|
|
}
|
|
|
|
# ************************************************
|
|
# Create the SmartScraperGraph instance and run it
|
|
# ************************************************
|
|
|
|
smart_scraper_graph = SmartScraperGraph(
|
|
prompt="Extract me the python code inside the page",
|
|
source="https://www.exploit-db.com/exploits/51447",
|
|
config=graph_config,
|
|
)
|
|
|
|
result = smart_scraper_graph.run()
|
|
print(json.dumps(result, indent=4))
|
|
|
|
# ************************************************
|
|
# Get graph execution info
|
|
# ************************************************
|
|
|
|
graph_exec_info = smart_scraper_graph.get_execution_info()
|
|
print(prettify_exec_info(graph_exec_info))
|