Example #1
0
 /**
  * @param Tracker $tracker
  * @param array $hashes
  * @return null|array
  */
 public function scrape(Tracker $tracker, array $hashes)
 {
     $query = $this->prepareQueries($hashes);
     if (empty($query)) {
         return null;
     }
     return $this->collectData($tracker->getUrl(), $query);
 }
Example #2
0
 /**
  * @param string $url
  * @param array $hashes
  * @return array|bool
  */
 public function scrape($url, array $hashes)
 {
     $tracker = Tracker::parse($url);
     if (empty($tracker)) {
         return false;
     }
     $scraper = $this->getScraperByScheme($tracker->scheme);
     if (empty($scraper)) {
         return false;
     }
     try {
         return $scraper->scrape($tracker, $hashes);
     } catch (ScraperException $e) {
         return false;
     }
 }