1
0
Fork 0
mirror of https://gitlab.com/news-flash/article_scraper.git synced 2025-07-07 08:05:31 +02:00

add fn to parse thumbnail from html

This commit is contained in:
Jan Lukas Gernert 2023-06-26 23:22:08 +02:00
parent e32015c1d0
commit 4fd41d98cc

View file

@ -427,6 +427,15 @@ impl FullTextParser {
conf
}
pub fn thumbnail_from_html(html: &str) -> Option<String> {
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<String> {
if let Ok(thumb) = Util::get_attribute(
context,