Skip to main content

extract_content_by_selector

Function extract_content_by_selector 

Source
pub fn extract_content_by_selector(
    raw_html: &str,
    content_selector: &str,
) -> Result<String>
Expand description

使用 CSS 选择器提取文章正文

let html = r#"<html><body><div class="content">正文</div></body></html>"#;
let content = crawlkit_parser::html::extract_content_by_selector(html, "div.content").unwrap();