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

Function targeted_extraction

docs/examples/quickstart_sync.py:157–165  ·  view source on GitHub ↗
(crawler)

Source from the content-addressed store, hash-verified

155 print_result(result)
156
157def targeted_extraction(crawler):
158 # Using a CSS selector to extract only H2 tags
159 cprint("\n🎯 [bold cyan]Targeted extraction: Let's use a CSS selector to extract only H2 tags![/bold cyan]", True)
160 result = crawler.run(
161 url="https://www.nbcnews.com/business",
162 css_selector="h2"
163 )
164 cprint("[LOG] 📦 [bold yellow]CSS Selector (H2 tags) result:[/bold yellow]")
165 print_result(result)
166
167def interactive_extraction(crawler):
168 # Passing JavaScript code to interact with the page

Callers 1

mainFunction · 0.85

Calls 3

cprintFunction · 0.85
print_resultFunction · 0.85
runMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…