public function onHtmlResponse(CrawlerHtmlResponseEvent $event, $eventName, EventDispatcherInterface $dispatcher) { $crawler = $event->getDomCrawler(); $nodes = $crawler->filterXPath('descendant-or-self::link[@rel = "stylesheet" and (@href)]'); $urls = $nodes->extract('href'); $this->processUris($event, $dispatcher, $urls, 'stylesheet'); }
/** * Discover link URLS from anchor tags. * * @param \LastCall\Crawler\Event\CrawlerHtmlResponseEvent $event * @param $eventName * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher */ public function onHtmlResponse(CrawlerHtmlResponseEvent $event, $eventName, EventDispatcherInterface $dispatcher) { $crawler = $event->getDomCrawler(); $nodes = $crawler->filterXPath('descendant-or-self::a[@href]'); $urls = array_unique($nodes->extract('href')); $this->processUris($event, $dispatcher, $urls, 'link'); }
public function onHtmlResponse(CrawlerHtmlResponseEvent $event, $eventName, EventDispatcherInterface $dispatcher) { $crawler = $event->getDomCrawler(); $nodes = $crawler->filterXPath('descendant-or-self::script[@type = "text/javascript" and (@src)]'); $urls = $nodes->extract('src'); $this->processUris($event, $dispatcher, $urls, 'script'); }
public function onHtmlResponse(CrawlerHtmlResponseEvent $event, $eventName, EventDispatcherInterface $dispatcher) { $crawler = $event->getDomCrawler(); $nodes = $crawler->filterXPath('descendant-or-self::img[@src]'); $urls = $nodes->extract('src'); $this->processUris($event, $dispatcher, $urls, 'image'); }