diff --git a/article_scraper/src/full_text_parser/mod.rs b/article_scraper/src/full_text_parser/mod.rs index c7d8d9e..a25df4e 100644 --- a/article_scraper/src/full_text_parser/mod.rs +++ b/article_scraper/src/full_text_parser/mod.rs @@ -288,7 +288,7 @@ impl FullTextParser { } } - fn parse_html_string_patched( + pub(crate) fn parse_html_string_patched( input: &str, parser: &Parser, ) -> Result { @@ -691,6 +691,7 @@ impl FullTextParser { .ok() .and_then(|()| node.set_property("width", "100%").ok()) .and_then(|()| node.set_property("height", "400").ok()) + .and_then(|()| node.remove_attribute("aspect-ratio").ok()) .ok_or_else(|| { node.unlink(); video_wrapper.add_child(&mut node) diff --git a/article_scraper/src/util.rs b/article_scraper/src/util.rs index e605015..fa86b5b 100644 --- a/article_scraper/src/util.rs +++ b/article_scraper/src/util.rs @@ -1259,14 +1259,14 @@ impl Util { #[cfg(test)] mod tests { use libxml::parser::Parser; - + use crate::FullTextParser; use super::Util; fn replace_brs(source: &str, expected: &str) { libxml::tree::node::set_node_rc_guard(10); let parser = Parser::default_html(); - let document = parser.parse_string(source).unwrap(); + let document = FullTextParser::parse_html_string_patched(source, &parser).unwrap(); let root = document.get_root_element().unwrap(); let body = root.get_first_child().unwrap(); let div = body.get_first_child().unwrap();