From d5a33248372a7ef03072b2c6c2f0fb621f34e061 Mon Sep 17 00:00:00 2001 From: Bill Thiede Date: Thu, 12 Sep 2024 09:27:57 -0700 Subject: [PATCH] server: slurp config for prusa blog and squelch some info logging --- server/src/lib.rs | 5 +---- server/src/newsreader.rs | 3 +++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/server/src/lib.rs b/server/src/lib.rs index 5184091..47892c3 100644 --- a/server/src/lib.rs +++ b/server/src/lib.rs @@ -8,7 +8,7 @@ use std::{collections::HashMap, convert::Infallible, str::FromStr}; use async_trait::async_trait; use css_inline::{CSSInliner, InlineError, InlineOptions}; use linkify::{LinkFinder, LinkKind}; -use log::{error, info, warn}; +use log::{error, warn}; use lol_html::{ element, errors::RewritingError, html_content::ContentType, rewrite_str, text, RewriteStrSettings, @@ -141,7 +141,6 @@ impl Transformer for FrameImages { RewriteStrSettings { element_content_handlers: vec![ element!("img[data-src]", |el| { - info!("found image with data-src {el:?}"); let src = el .get_attribute("data-src") .unwrap_or("https://placehold.co/600x400".to_string()); @@ -150,7 +149,6 @@ impl Transformer for FrameImages { Ok(()) }), element!("img[data-cfsrc]", |el| { - info!("found image with data-cfsrc {el:?}"); let src = el .get_attribute("data-cfsrc") .unwrap_or("https://placehold.co/600x400".to_string()); @@ -159,7 +157,6 @@ impl Transformer for FrameImages { Ok(()) }), element!("img[alt], img[title]", |el| { - info!("found image with alt or title {el:?}"); let src = el .get_attribute("src") .unwrap_or("https://placehold.co/600x400".to_string()); diff --git a/server/src/newsreader.rs b/server/src/newsreader.rs index f522389..6fda94d 100644 --- a/server/src/newsreader.rs +++ b/server/src/newsreader.rs @@ -179,6 +179,9 @@ pub async fn thread(pool: &PgPool, thread_id: String) -> Result vec![ Selector::parse("div.entry-content").unwrap(), ], + "blog.prusa3d.com".to_string() => vec![ + Selector::parse("article.content").unwrap(), + ], "blog.cloudflare.com".to_string() => vec![ Selector::parse(".author-lists").unwrap(), Selector::parse(".post-full-content").unwrap()