Example #1
0
 /**
  * @param Crawler $crawler
  * @return ExtractedAlbum
  */
 public function extract(Crawler $crawler)
 {
     $album = new ExtractedAlbum();
     $album->setTitle(StringHelper::filterText($crawler, 'title'));
     if ($crawler->filter("meta[name='description']")->count() > 0) {
         $album->setDescription($crawler->filter("meta[name='description']")->attr('content'));
     }
     $album->setImages($this->extractImages($crawler));
     return $album;
 }
Example #2
0
 /**
  * @param Crawler $crawler
  * @return ExtractedAlbum
  */
 public function extract(Crawler $crawler)
 {
     $album = new ExtractedAlbum();
     $album->setTitle(StringHelper::filterText($crawler, '#project-name'));
     $publishedTimestamp = $crawler->filter('.project-published .js-format-timestamp')->attr('data-timestamp');
     $publishedDatetime = new \DateTime();
     $publishedDatetime->setTimestamp($publishedTimestamp);
     $album->setPublishedOn($publishedDatetime);
     $description = StringHelper::filterText($crawler, '#project-block-footer-basic-info');
     $description = str_replace('Basic Info', '', $description);
     $description = str_replace('Published:', '', $description);
     $description = trim($description);
     $album->setDescription($description);
     $album->setStats($this->extractStats($crawler));
     $album->setOwner($this->extractOwner($crawler));
     $album->setImages($this->extractImages($crawler));
     $album->setVideos($this->extractVideos($crawler));
     return $album;
 }
Example #3
0
 /**
  * @param Crawler $crawler
  * @return ExtractedAlbum
  */
 public function extract(Crawler $crawler)
 {
     if (StringHelper::contains($this->url, '/gallery/')) {
         if (is_null($this->pageFetcher)) {
             $this->pageFetcher = new CurlPageFetcher();
         }
         $html = $this->pageFetcher->fetch(str_replace('/gallery/', '/a/', $this->url));
         $crawler = new Crawler($html);
     }
     $album = new ExtractedAlbum();
     if ($crawler->filter('.album-description h1')->count() > 0) {
         $album->setTitle($crawler->filter('.album-description h1')->text());
     }
     if ($crawler->filter('.album-description p')->count() > 0) {
         $album->setDescription($crawler->filter('.album-description p')->text());
     }
     $album->setImages($this->extractImages($crawler));
     $album->setStats($this->extractStats($crawler));
     $album->setOwner($this->extractOwner($crawler));
     return $album;
 }