import os from scrapegraphai.graphs import SmartScraperGraph from scrapegraphai.utils import prettify_exec_info import nest_asyncio nest_asyncio.apply()
PROMPT = ''' Please provide the following information, which is typically found on the school's About page: 1. Founding date 2. School history 3. School philosophy 4. School motto 5. School vision 6. School mission 7. School values
Please visit the school's official website, navigate to the About or similar page, and extract the above information. If you cannot find all the details, please provide as much relevant information as possible. Thank you!
'''
smart_scraper_graph = SmartScraperGraph( prompt=PROMPT, # also accepts a string with the already downloaded HTML code source="https://www.nyu.edu", config=graph_config )
from scrapegraphai.graphs import SmartScraperGraph
start = time.time()
graph_config = { "llm": { "model": "ollama/qwen2:latest", "temperature": 0, "format": "json", # Ollama needs the format to be specified explicitly "base_url": "****", # set Ollama URL }, "embeddings": { "model": "ollama/nomic-embed-text", "base_url": "****", # set Ollama URL }, "verbose": True, }
smart_scraper_graph = SmartScraperGraph( prompt=PROMPT, # also accepts a string with the already downloaded HTML code source="https://www.nyu.edu", config=graph_config )
result = smart_scraper_graph.run() print(result) end = time.time()