rom scrapegraphai.graphs import SmartScraperGraph
graph_config = {
"llm": {
"model": "ollama/llama3",
"temperature": 0,
"format": "json", # Ollama 需要显式指定格式
"base_url": "http://localhost:11434", # 设置 Ollama URL
},
"embeddings": {
"model": "ollama/nomic-embed-text",
"base_url": "http://localhost:11434", # 设置 Ollama URL
},
"verbose": True,
}
smart_scraper_graph = SmartScraperGraph(
prompt="返回该网站所有文章的标题、日期、文章链接",
# 也接受已下载的 HTML 代码的字符串
#source=requests.get("https://textdata.cn/blog/").text,
source="https://textdata.cn/blog/",
config=graph_config
)
result = smart_scraper_graph.run()
print(result)
graph_config = {
"llm": {
"model": "ollama/llama3",
"temperature": 0,
"format": "json", # Ollama 需要显式指定格式
"base_url": "http://localhost:11434", # 设置 Ollama URL
},
"embeddings": {
"model": "ollama/nomic-embed-text",
"base_url": "http://localhost:11434", # 设置 Ollama URL
},
"verbose": True,
}
smart_scraper_graph = SmartScraperGraph(
prompt="返回该网站所有文章的标题、日期、文章链接",
# 也接受已下载的 HTML 代码的字符串
#source=requests.get("https://textdata.cn/blog/").text,
source="https://textdata.cn/blog/",
config=graph_config
)
result = smart_scraper_graph.run()
print(result)
textdata.cn
Blogs
专注社会科学(经济管理)科研领域的Python文本图片数据分析,涵盖数据分析主要环节,如Python网络爬虫、Pandas数据探索性分析、中英文文本数据清洗、机器学习与自然语言处理。开发有专门的Python经济管理文本数据挖掘视频课程。可应对会计、营销、管理信息系统、公司金融、社会学、传播学、新闻学等方向的科研数据需要。Focusing on Python text and image data analysis in the field of social science (economic management)…
❤1👍1