private function removeComments(HtmlDomParser $dom): HtmlDomParser
    {
        foreach ($dom->find('//comment()') as $commentWrapper) {
            $comment = $commentWrapper->getNode();
            $val = $comment->nodeValue;
            if (\strpos($val, '[') === false) {
                /** @noinspection UnusedFunctionResultInspection */
                $comment->parentNode->removeChild($comment);
            }
        }

        $dom->getDocument()->normalizeDocument();

        return $dom;
    }