mirror of
https://gitlab.com/news-flash/article_scraper.git
synced 2025-07-07 16:15:32 +02:00
fmt
This commit is contained in:
parent
22e98fdab7
commit
dc1bf2ef0c
1 changed files with 16 additions and 6 deletions
|
@ -356,19 +356,29 @@ impl FullTextParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn check_for_thumbnail(context: &Context, article: &mut Article) {
|
fn check_for_thumbnail(context: &Context, article: &mut Article) {
|
||||||
if let Some(thumb) = Self::get_attribute(context, "//meta[contains(@name, 'twitter:image')]", "content").ok() {
|
if let Some(thumb) = Self::get_attribute(
|
||||||
|
context,
|
||||||
|
"//meta[contains(@name, 'twitter:image')]",
|
||||||
|
"content",
|
||||||
|
)
|
||||||
|
.ok()
|
||||||
|
{
|
||||||
article.thumbnail_url = Some(thumb);
|
article.thumbnail_url = Some(thumb);
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(thumb) = Self::get_attribute(context, "//meta[contains(@name, 'og:image')]", "content").ok() {
|
if let Some(thumb) =
|
||||||
|
Self::get_attribute(context, "//meta[contains(@name, 'og:image')]", "content").ok()
|
||||||
|
{
|
||||||
article.thumbnail_url = Some(thumb);
|
article.thumbnail_url = Some(thumb);
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(thumb) = Self::get_attribute(context, "//link[contains(@rel, 'image_src')]", "href").ok() {
|
if let Some(thumb) =
|
||||||
|
Self::get_attribute(context, "//link[contains(@rel, 'image_src')]", "href").ok()
|
||||||
|
{
|
||||||
article.thumbnail_url = Some(thumb);
|
article.thumbnail_url = Some(thumb);
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue