Goose\Modules\Extractors\MetaExtractor::getTitle PHP Method

getTitle() private method

Ported from python-goose https://github.com/grangier/python-goose/ by Xavier Grangier
private getTitle ( ) : string
return string
    private function getTitle()
    {
        $openGraph = $this->article()->getOpenGraph();
        // Rely on OpenGraph in case we have the data
        if (isset($openGraph['title'])) {
            return $this->cleanTitle($openGraph['title']);
        }
        $nodes = $this->getNodesByLowercasePropertyValue($this->article()->getDoc(), 'meta', 'name', 'headline');
        if ($nodes->count()) {
            return $this->cleanTitle($nodes->first()->attr('content'));
        }
        $nodes = $this->article()->getDoc()->find('html > head > title');
        if ($nodes->count()) {
            return $this->cleanTitle(Helper::textNormalise($nodes->first()->text()));
        }
        return '';
    }