Python scraper based on AI
Python ai-crawlerai-scrapingai-searchcrawlerdata-extractionfirecrawl-alternativelarge-language-modelllmmarkdownragscrapingscraping-pythonweb-crawlerweb-crawlersweb-dataweb-data-extractionweb-scraperweb-scrapingweb-searchwebscraping
accessibility tree
Marco Periniedfaf3fa534b
diff --git a/examples/custom_graph_domtree.py b/examples/custom_graph_domtree.pyindex 5cf6443d..77aec812 100644--- a/examples/custom_graph_domtree.py+++ b/examples/custom_graph_domtree.py@@ -145,11 +145,27 @@ subtree_dict_complex = {}}-result, execution_info = graph.execute({- "user_prompt": "How many list items are there in the document?",- "local_dir": str(subtree_dict_simple)-})--# get the answer from the result-result = result.get("answer", "No answer found.")-print(result)+from playwright.sync_api import sync_playwright, Playwright++def run(playwright: Playwright):+ chromium = playwright.chromium # or "firefox" or "webkit".+ browser = chromium.launch()+ page = browser.new_page()+ page.goto("https://www.wired.com/category/science/")+ #get accessibilty tree+ accessibility_tree = page.accessibility.snapshot()++ result, execution_info = graph.execute({+ "user_prompt": "List me all the latest news with their description.",+ "local_dir": str(accessibility_tree)+ })++ # get the answer from the result+ result = result.get("answer", "No answer found.")+ print(result)+ # other actions...+ browser.close()++with sync_playwright() as playwright:+ run(playwright)+