Arachnid\Crawler::extractTitleInfo PHP Method

extractTitleInfo() protected method

Extract title information from url
protected extractTitleInfo ( Crawler $crawler, string $url )
$crawler Symfony\Component\DomCrawler\Crawler
$url string
    protected function extractTitleInfo(DomCrawler $crawler, $url)
    {
        $crawler->filterXPath('//head//title')->each(function (DomCrawler $node) use($url) {
            $this->links[$url]['title'] = trim($node->text());
        });
        $h1_count = $crawler->filter('h1')->count();
        $this->links[$url]['h1_count'] = $h1_count;
        $this->links[$url]['h1_contents'] = array();
        if ($h1_count > 0) {
            $crawler->filter('h1')->each(function (DomCrawler $node, $i) use($url) {
                $this->links[$url]['h1_contents'][$i] = trim($node->text());
            });
        }
    }