diff --git a/lib/frontend.php b/lib/frontend.php index 4156a76..592b33a 100644 --- a/lib/frontend.php +++ b/lib/frontend.php @@ -1008,7 +1008,8 @@ class frontend{ "startpage" => "Startpage", "qwant" => "Qwant", "yep" => "Yep", - "mojeek" => "Mojeek" + "mojeek" => "Mojeek", + "baidu" => "Baidu" ] ]; break; diff --git a/lib/fuckhtml.php b/lib/fuckhtml.php index 5b45578..c90d1e8 100644 --- a/lib/fuckhtml.php +++ b/lib/fuckhtml.php @@ -240,12 +240,13 @@ class fuckhtml{ public function getElementsByFuzzyAttributeValue(string $name, string $value, $collection = null){ $elems = $this->getElementsByAttributeName($name, $collection); + $value = explode( " ", trim( preg_replace( - '/ +/', + '/ \s+/', " ", $value ) @@ -258,7 +259,18 @@ class fuckhtml{ foreach($elem["attributes"] as $attrib_name => $attrib_value){ - $attrib_value = explode(" ", $attrib_value); + $attrib_value = + explode( + " ", + trim( + preg_replace( + '/\s+/', + " ", + $attrib_value + ) + ) + ); + $ac = count($attrib_value); $nc = count($value); $cr = 0;