bs4-script.py
This commit is contained in:
28
ScriptCreator.py
Normal file
28
ScriptCreator.py
Normal file
@ -0,0 +1,28 @@
|
||||
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)
|
Reference in New Issue
Block a user