pub struct ExtractedLink {
pub url: String,
pub text: String,
pub score: f32,
pub cluster_size: usize,
}Expand description
提取到的候选文章链接。
包含 URL、锚文本、综合得分以及所在列表结构的聚类大小。
use crawlkit_parser::{LinkExtractor, ExtractorConfig};
let html = r#"<a href="/2024/01/15/story">文章标题</a>"#;
let extractor = LinkExtractor::new(ExtractorConfig::default());
let results = extractor.extract(html, "https://example.com/");
for link in &results {
println!("{} | score={} | cluster={}", link.url, link.score, link.cluster_size);
}Fields§
§url: String完整 URL(已解析为绝对地址)
text: String锚文本(已清理多余空白)
score: f32综合评分(8 个信号的加权和,越高越可能是文章链接)
cluster_size: usize该链接所在 DOM 路径下同类链接的数量(列表结构强度)
Trait Implementations§
Source§impl Clone for ExtractedLink
impl Clone for ExtractedLink
Source§fn clone(&self) -> ExtractedLink
fn clone(&self) -> ExtractedLink
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ExtractedLink
impl RefUnwindSafe for ExtractedLink
impl Send for ExtractedLink
impl Sync for ExtractedLink
impl Unpin for ExtractedLink
impl UnsafeUnpin for ExtractedLink
impl UnwindSafe for ExtractedLink
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