Files
ScrapeGraphAI-experiments/ScriptCreator.py
2025-01-16 15:57:50 +08:00

29 lines
781 B
Python

from scrapegraphai.graphs import ScriptCreatorGraph
graph_config = {
"llm": {
"model": "ollama/mistral-nemo:12b",
"model_tokens": 1024000,
"temperature": 0,
},
"library": "beautifulsoup4",
# https://scrapegraph-ai.readthedocs.io/en/latest/scrapers/types.html#scriptcreatorgraph-scriptcreatormultigraph
"verbose": True,
# "headless": False,
}
# #############################
prompt = "创建一个Python脚本来抓取页面上的所有站点以及站点信息"
with open('source/satnogs.html', 'r', encoding='utf-8') as file:
source = file.read()
script_creator_graph = ScriptCreatorGraph(
prompt=prompt,
source=source,
config=graph_config,
# schema=schema
)
result = script_creator_graph.run()
print(result)