MCPcopy Create free account
hub / github.com/unclecode/crawl4ai / process_sections

Function process_sections

crawl4ai/utils.py:952–966  ·  view source on GitHub ↗
(url: str, sections: list, provider: str, api_token: str, base_url=None)

Source from the content-addressed store, hash-verified

950 return merged_sections
951
952def process_sections(url: str, sections: list, provider: str, api_token: str, base_url=None) -> list:
953 extracted_content = []
954 if provider.startswith("groq/"):
955 # Sequential processing with a delay
956 for section in sections:
957 extracted_content.extend(extract_blocks(url, section, provider, api_token, base_url=base_url))
958 time.sleep(0.5) # 500 ms delay between each processing
959 else:
960 # Parallel processing using ThreadPoolExecutor
961 with ThreadPoolExecutor() as executor:
962 futures = [executor.submit(extract_blocks, url, section, provider, api_token, base_url=base_url) for section in sections]
963 for future in as_completed(futures):
964 extracted_content.extend(future.result())
965
966 return extracted_content
967
968def wrap_text(draw, text, font, max_width):
969 # Wrap the text to fit within the specified width

Callers

nothing calls this directly

Calls 1

extract_blocksFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…