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:
parent
e32015c1d0
commit
4fd41d98cc
1 changed files with 9 additions and 0 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue