server: slurp config for prusa blog and squelch some info logging
This commit is contained in:
parent
f5c90d8770
commit
d5a3324837
@ -8,7 +8,7 @@ use std::{collections::HashMap, convert::Infallible, str::FromStr};
|
|||||||
use async_trait::async_trait;
|
use async_trait::async_trait;
|
||||||
use css_inline::{CSSInliner, InlineError, InlineOptions};
|
use css_inline::{CSSInliner, InlineError, InlineOptions};
|
||||||
use linkify::{LinkFinder, LinkKind};
|
use linkify::{LinkFinder, LinkKind};
|
||||||
use log::{error, info, warn};
|
use log::{error, warn};
|
||||||
use lol_html::{
|
use lol_html::{
|
||||||
element, errors::RewritingError, html_content::ContentType, rewrite_str, text,
|
element, errors::RewritingError, html_content::ContentType, rewrite_str, text,
|
||||||
RewriteStrSettings,
|
RewriteStrSettings,
|
||||||
@ -141,7 +141,6 @@ impl Transformer for FrameImages {
|
|||||||
RewriteStrSettings {
|
RewriteStrSettings {
|
||||||
element_content_handlers: vec![
|
element_content_handlers: vec![
|
||||||
element!("img[data-src]", |el| {
|
element!("img[data-src]", |el| {
|
||||||
info!("found image with data-src {el:?}");
|
|
||||||
let src = el
|
let src = el
|
||||||
.get_attribute("data-src")
|
.get_attribute("data-src")
|
||||||
.unwrap_or("https://placehold.co/600x400".to_string());
|
.unwrap_or("https://placehold.co/600x400".to_string());
|
||||||
@ -150,7 +149,6 @@ impl Transformer for FrameImages {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}),
|
}),
|
||||||
element!("img[data-cfsrc]", |el| {
|
element!("img[data-cfsrc]", |el| {
|
||||||
info!("found image with data-cfsrc {el:?}");
|
|
||||||
let src = el
|
let src = el
|
||||||
.get_attribute("data-cfsrc")
|
.get_attribute("data-cfsrc")
|
||||||
.unwrap_or("https://placehold.co/600x400".to_string());
|
.unwrap_or("https://placehold.co/600x400".to_string());
|
||||||
@ -159,7 +157,6 @@ impl Transformer for FrameImages {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}),
|
}),
|
||||||
element!("img[alt], img[title]", |el| {
|
element!("img[alt], img[title]", |el| {
|
||||||
info!("found image with alt or title {el:?}");
|
|
||||||
let src = el
|
let src = el
|
||||||
.get_attribute("src")
|
.get_attribute("src")
|
||||||
.unwrap_or("https://placehold.co/600x400".to_string());
|
.unwrap_or("https://placehold.co/600x400".to_string());
|
||||||
|
|||||||
@ -179,6 +179,9 @@ pub async fn thread(pool: &PgPool, thread_id: String) -> Result<Thread, ServerEr
|
|||||||
"atmeta.com".to_string() => vec![
|
"atmeta.com".to_string() => vec![
|
||||||
Selector::parse("div.entry-content").unwrap(),
|
Selector::parse("div.entry-content").unwrap(),
|
||||||
],
|
],
|
||||||
|
"blog.prusa3d.com".to_string() => vec![
|
||||||
|
Selector::parse("article.content").unwrap(),
|
||||||
|
],
|
||||||
"blog.cloudflare.com".to_string() => vec![
|
"blog.cloudflare.com".to_string() => vec![
|
||||||
Selector::parse(".author-lists").unwrap(),
|
Selector::parse(".author-lists").unwrap(),
|
||||||
Selector::parse(".post-full-content").unwrap()
|
Selector::parse(".post-full-content").unwrap()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user