crawl4aivskimurai
Crawl4AI is an open-source AI-powered web crawling and data extraction library for Python. It uses large language models (LLMs) to intelligently extract structured data from web pages with minimal code. Unlike traditional scraping frameworks that rely on CSS selectors or XPath, Crawl4AI can understand page content semantically and extract data based on natural language descriptions of what you want.
Key features include:
- LLM-based extraction Define what data you want in plain English and Crawl4AI uses LLMs to find and extract it from the page content. Supports multiple LLM providers including OpenAI, Anthropic, and local models.
- Automatic crawling Built-in crawler with support for JavaScript rendering, parallel crawling, and session management.
- Structured output Returns data in structured formats (JSON, Pydantic models) making it easy to integrate into data pipelines.
- Markdown conversion Can convert web pages to clean markdown format, useful for feeding content to LLMs.
- Chunking strategies Multiple strategies for breaking down large pages into processable chunks for LLM extraction.
- Async support Built on async Python for efficient concurrent crawling and extraction.
Crawl4AI is particularly useful for scraping unstructured content where writing traditional CSS/XPath selectors would be tedious or fragile. It excels at content extraction, article parsing, and data mining from diverse page layouts.
Kimurai is a modern web scraping framework for Ruby, inspired by Python's Scrapy. It provides a structured approach to building web scrapers with built-in support for multiple browser engines, session management, and data pipelines.
Key features include:
- Multiple engine support Can use different backends depending on the scraping needs: Mechanize for simple HTTP requests, Selenium with headless Chrome/Firefox for JavaScript-rendered pages, and Poltergeist (PhantomJS) for lightweight rendering.
- Scrapy-like architecture Follows the spider pattern: define a spider class with start URLs and parsing methods, and the framework handles crawling, scheduling, and data collection.
- Built-in data pipelines Save scraped data to JSON, CSV, or custom formats with configurable output pipelines.
- Session management Maintains browser sessions with automatic cookie handling and configurable delays between requests.
- Request scheduling Built-in request queue with configurable concurrency, delays, and retry logic.
- CLI tools Command-line tools for generating new spiders, running individual spiders, and managing scraping projects.
Kimurai is the closest Ruby equivalent to Scrapy. It's well-suited for structured scraping projects that need organization, multiple spiders, and data pipeline processing.
Note: Kimurai has not seen active development recently, but it remains a useful framework for Ruby scraping projects and is included as the most complete Ruby scraping framework available.
Highlights
Example Use
from crawl4ai import AsyncWebCrawler, CrawlerRunConfig
from crawl4ai.extraction_strategy import LLMExtractionStrategy
import asyncio
async def main():
# Basic crawling - get page as markdown
async with AsyncWebCrawler() as crawler:
result = await crawler.arun(url="https://example.com")
print(result.markdown) # clean markdown content
# AI-powered extraction with structured output
strategy = LLMExtractionStrategy(
instruction="Extract all product names and prices from this page",
)
config = CrawlerRunConfig(extraction_strategy=strategy)
async with AsyncWebCrawler() as crawler:
result = await crawler.arun(
url="https://example.com/products",
config=config,
)
print(result.extracted_content) # structured JSON output
asyncio.run(main())
require 'kimurai'
class ProductSpider < Kimurai::Base
@name = 'product_spider'
@engine = :selenium_chrome # or :mechanize for simple pages
@start_urls = ['https://example.com/products']
def parse(response, url:, data: {})
# Extract product data from current page
response.css('.product').each do |product|
item = {
name: product.css('.name').text.strip,
price: product.css('.price').text.strip,
url: absolute_url(product.at_css('a')['href'], base: url),
}
# Send item to the pipeline
save_to "products.json", item, format: :json
end
# Follow pagination links
if next_page = response.at_css('a.next-page')
request_to :parse, url: absolute_url(next_page['href'], base: url)
end
end
end
# Run the spider
ProductSpider.crawl!