diff --git a/article_scraper/src/full_text_parser/mod.rs b/article_scraper/src/full_text_parser/mod.rs index c389a8d..b714827 100644 --- a/article_scraper/src/full_text_parser/mod.rs +++ b/article_scraper/src/full_text_parser/mod.rs @@ -427,6 +427,15 @@ impl FullTextParser { conf } + pub fn thumbnail_from_html(html: &str) -> Option { + if let Ok(doc) = Self::parse_html(html, None, &ConfigEntry::default()) { + if let Ok(ctx) = Self::get_xpath_ctx(&doc) { + return Self::check_for_thumbnail(&ctx); + } + } + None + } + pub fn check_for_thumbnail(context: &Context) -> Option { if let Ok(thumb) = Util::get_attribute( context,