pub struct HtmlParser;Implementations§
Source§impl HtmlParser
impl HtmlParser
Sourcepub fn extract_text(element: ElementRef<'_>) -> String
pub fn extract_text(element: ElementRef<'_>) -> String
Extract text content from element
Sourcepub fn get_element_path(element: ElementRef<'_>) -> String
pub fn get_element_path(element: ElementRef<'_>) -> String
Get XPath-like selector for element
Sourcepub fn clean_html(html: &str) -> Result<Html>
pub fn clean_html(html: &str) -> Result<Html>
Clean HTML by removing script, style, comments, etc.
Sourcepub fn get_candidate_nodes(document: &Html, top_k: usize) -> Vec<ElementRef<'_>>
pub fn get_candidate_nodes(document: &Html, top_k: usize) -> Vec<ElementRef<'_>>
Get candidate article nodes from document
Sourcepub fn extract_paragraphs(element: ElementRef<'_>) -> Vec<String>
pub fn extract_paragraphs(element: ElementRef<'_>) -> Vec<String>
Extract paragraphs from element
Sourcepub fn get_parent(element: ElementRef<'_>) -> Option<ElementRef<'_>>
pub fn get_parent(element: ElementRef<'_>) -> Option<ElementRef<'_>>
Get parent element
Sourcepub fn get_prev_sibling(element: ElementRef<'_>) -> Option<ElementRef<'_>>
pub fn get_prev_sibling(element: ElementRef<'_>) -> Option<ElementRef<'_>>
Get previous sibling element
Sourcepub fn get_next_sibling(element: ElementRef<'_>) -> Option<ElementRef<'_>>
pub fn get_next_sibling(element: ElementRef<'_>) -> Option<ElementRef<'_>>
Get next sibling element
Sourcepub fn count_children(element: ElementRef<'_>) -> usize
pub fn count_children(element: ElementRef<'_>) -> usize
Count child elements
Sourcepub fn get_tree_depth(document: &Html) -> usize
pub fn get_tree_depth(document: &Html) -> usize
Get tree depth
Sourcepub fn get_node_depth(element: ElementRef<'_>) -> usize
pub fn get_node_depth(element: ElementRef<'_>) -> usize
Get node depth in tree
Auto Trait Implementations§
impl Freeze for HtmlParser
impl RefUnwindSafe for HtmlParser
impl Send for HtmlParser
impl Sync for HtmlParser
impl Unpin for HtmlParser
impl UnsafeUnpin for HtmlParser
impl UnwindSafe for HtmlParser
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more