Skip to main content

parse_duckduckgo_html

Function parse_duckduckgo_html 

Source
pub fn parse_duckduckgo_html(
    body: &str,
    max_results: usize,
) -> Vec<SearchResult>
Expand description

Extract ranked results from a DuckDuckGo HTML body. Pure function so it can be exercised in unit tests against a local fixture (no live network).

Single streaming pass: a result anchor opens title collection, its first </a> completes it, and the following result__snippet element (before the next result anchor) supplies the snippet. First-close-wins keeps parity with the previous extractor on well-formed markup.