AutoCrawler

AutoCrawler is a two-stage framework that combines LLMs with the hierarchical structure of HTML to auto-generate reusable web scrapers. Wrapper-based scrapers break on new sites and pure LLM agents don't reuse well across pages; AutoCrawler addresses both limitations.
Ask this paper
Hierarchical DOM understanding: The agent walks the HTML tree with top-down and step-back operations, progressively refining its understanding of a page before emitting a complete and executable scraper.
Similarity across pages: Patterns learned on one page of a site generalize to structurally similar pages, making the generated scraper durable rather than a one-shot extraction.
New executability metric: The paper introduces an executability metric for evaluating scraper-generation systems, filling a gap in prior benchmarks that focused only on extraction accuracy.
EMNLP 2024: Experiments across multiple LLM backends validate the framework on diverse websites; the work was accepted to EMNLP 2024.
Abstract
Web scraping is a powerful technique that extracts data from websites, enabling automated data collection, enhancing data analysis capabilities, and minimizing manual data entry efforts. Existing methods, wrappers-based methods suffer from limited adaptability and scalability when faced with a new website, while language agents, empowered by large language models (LLMs), exhibit poor reusability in diverse web environments. In this work, we introduce the paradigm of generating web scrapers with LLMs and propose AutoScraper, a two-stage framework that can handle diverse and changing web environments more efficiently. AutoScraper leverages the hierarchical structure of HTML and similarity across different web pages for generating web scrapers. Besides, we propose a new executability metric for better measuring the performance of web scraper generation tasks. We conduct comprehensive experiments with multiple LLMs and demonstrate the effectiveness of our framework. Resources of this paper can be found at \url{https://github.com/EZ-hwh/AutoScraper}