mirror of
https://gitlab.com/news-flash/article_scraper.git
synced 2025-07-08 08:30:00 +02:00
fixes
This commit is contained in:
parent
d8e3a75b01
commit
0834c4d72a
8 changed files with 3234 additions and 489 deletions
|
@ -360,11 +360,11 @@ impl Util {
|
|||
|
||||
pub fn has_single_tag_inside_element(node: &Node, tag: &str) -> bool {
|
||||
// There should be exactly 1 element child with given tag
|
||||
if node.get_child_nodes().len() == 1
|
||||
if node.get_child_nodes().len() != 1
|
||||
|| node
|
||||
.get_child_nodes()
|
||||
.first()
|
||||
.map(|n| n.get_name().to_uppercase() == tag)
|
||||
.map(|n| n.get_name().to_uppercase() != tag)
|
||||
.unwrap_or(false)
|
||||
{
|
||||
return false;
|
||||
|
@ -438,8 +438,8 @@ impl Util {
|
|||
|
||||
// Determine whether element has any children block level elements.
|
||||
pub fn has_child_block_element(node: &Node) -> bool {
|
||||
node.get_child_elements().iter().any(|node| {
|
||||
constants::DIV_TO_P_ELEMS.contains(node.get_name().as_str())
|
||||
node.get_child_nodes().iter().any(|node| {
|
||||
constants::DIV_TO_P_ELEMS.contains(node.get_name().to_uppercase().as_str())
|
||||
|| Self::has_child_block_element(node)
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue