Spatie\Crawler\CrawlProfile::shouldCrawl PHP Method

shouldCrawl() public method

Determine if the given url should be crawled.
public shouldCrawl ( Url $url ) : boolean
$url Url
return boolean
    public function shouldCrawl(Url $url) : bool;

Usage Example

Ejemplo n.º 1
0
 /**
  * Crawl all links in the given html.
  *
  * @param string $html
  */
 protected function crawlAllLinks($html)
 {
     $allLinks = $this->getAllLinks($html);
     collect($allLinks)->reject(function (Url $url) {
         return $url->isEmailUrl() || $url->isTelUrl() || $url->isJavascript();
     })->map(function (Url $url) {
         return $this->normalizeUrl($url);
     })->filter(function (Url $url) {
         return $this->crawlProfile->shouldCrawl($url);
     })->each(function (Url $url) {
         $this->crawlUrl($url);
     });
 }
All Usage Examples Of Spatie\Crawler\CrawlProfile::shouldCrawl
CrawlProfile