MCPcopy
hub / github.com/unclecode/crawl4ai / main

Function main

docs/examples/quickstart_async.py:510–537  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

508
509
510async def main():
511 await simple_crawl()
512 await simple_example_with_running_js_code()
513 await simple_example_with_css_selector()
514 await use_proxy()
515 await capture_and_save_screenshot("https://www.example.com", os.path.join(__location__, "tmp/example_screenshot.jpg"))
516 await extract_structured_data_using_css_extractor()
517
518 # LLM extraction examples
519 await extract_structured_data_using_llm()
520 await extract_structured_data_using_llm("huggingface/meta-llama/Meta-Llama-3.1-8B-Instruct", os.getenv("HUGGINGFACE_API_KEY"))
521 await extract_structured_data_using_llm("openai/gpt-4o", os.getenv("OPENAI_API_KEY"))
522 await extract_structured_data_using_llm("ollama/llama3.2")
523
524 # You always can pass custom headers to the extraction strategy
525 custom_headers = {
526 "Authorization": "Bearer your-custom-token",
527 "X-Custom-Header": "Some-Value"
528 }
529 await extract_structured_data_using_llm(extra_headers=custom_headers)
530
531 # await crawl_dynamic_content_pages_method_1()
532 # await crawl_dynamic_content_pages_method_2()
533 await crawl_dynamic_content_pages_method_3()
534
535 await crawl_custom_browser_type()
536
537 await speed_comparison()
538
539
540if __name__ == "__main__":

Callers 1

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…