Exemple #1
0
 /**
  * @param Crawler $crawler
  * @return ExtractedStats
  */
 public function extractStats(Crawler $crawler)
 {
     $stats = new ExtractedStats();
     $stats->setViews(StringHelper::filterText($crawler, '#project-stats .beicons-pre-eye'));
     $stats->setLikes(StringHelper::filterText($crawler, '#project-stats .beicons-pre-thumb'));
     return $stats;
 }
Exemple #2
0
 /**
  * @param Crawler $crawler
  * @return ExtractedStats
  */
 public function extractStats(Crawler $crawler)
 {
     $stats = new ExtractedStats();
     $stats->setViews(StringHelper::filterText($crawler, '.view-count .view-count-label'));
     $stats->setLikes(StringHelper::filterText($crawler, '.fave-count .fave-count-label'));
     return $stats;
 }
Exemple #3
0
 /**
  * @param Crawler $crawler
  * @return ExtractedStats
  */
 public function extractStats(Crawler $crawler)
 {
     $stats = new ExtractedStats();
     $stats->setDislikes(trim($crawler->filter("*[title='I dislike this']")->text()));
     $stats->setLikes(trim($crawler->filter("*[title='I like this']")->text()));
     $stats->setViews(str_replace(',', '', StringHelper::filterText($crawler, ".watch-view-count")));
     return $stats;
 }
Exemple #4
0
 /**
  * @param Crawler $crawler
  * @return ExtractedStats
  */
 public function extractStats(Crawler $crawler)
 {
     $stats = new ExtractedStats();
     if ($crawler->filter('#views')->count() > 0) {
         $views = intval(str_replace(',', '', StringHelper::filterText($crawler, '#views')));
     }
     if ($crawler->filter('#stats-views')->count() > 0) {
         $views = intval(str_replace(',', '', StringHelper::filterText($crawler, '#stats-views')));
     }
     if ($crawler->filter('.views-info')->count() > 0) {
         $views = trim(str_replace(',', '', str_replace('views', '', StringHelper::filterText($crawler, '.views-info'))));
     }
     if (isset($views)) {
         $stats->setViews($views);
     }
     return $stats;
 }
Exemple #5
0
 /**
  * @return ExtractedStats|null
  */
 public function extractStats()
 {
     try {
         $statsCrawler = $this->getStatsPageCrawler();
         $stats = new ExtractedStats();
         $stats->setLikes(str_replace(',', '', StringHelper::filterText($statsCrawler, "#like_totals")));
         $views = StringHelper::filterText($statsCrawler, "#play_totals");
         if (StringHelper::endsWith($views, 'K')) {
             $views = rtrim($views, "K") * 1000;
         }
         $stats->setViews($views);
         return $stats;
     } catch (PageNotFoundException $e) {
         return null;
     } catch (ServerErrorException $e) {
         return null;
     }
 }
Exemple #6
0
 /**
  * @param Crawler $crawler
  * @return ExtractedStats
  */
 public function extractStats(Crawler $crawler)
 {
     $views = intval(str_replace(',', '', StringHelper::filterText($crawler, '.under-title-info span:nth-of-type(2)')));
     $stats = new ExtractedStats();
     $stats->setViews($views);
     return $stats;
 }