PicoFeed\Scraper\CandidateParser::findContentWithCandidates PHP Метод

findContentWithCandidates() публичный Метод

Find content based on the list of tag candidates.
public findContentWithCandidates ( ) : string
Результат string
    public function findContentWithCandidates()
    {
        foreach ($this->candidatesAttributes as $candidate) {
            Logger::setMessage(get_called_class() . ': Try this candidate: "' . $candidate . '"');
            $nodes = $this->xpath->query('//*[(contains(@class, "' . $candidate . '") or @id="' . $candidate . '") and not (contains(@class, "nav") or contains(@class, "page"))]');
            if ($nodes !== false && $nodes->length > 0) {
                Logger::setMessage(get_called_class() . ': Find candidate "' . $candidate . '"');
                return $this->dom->saveXML($nodes->item(0));
            }
        }
        return '';
    }