/** * Handle tmdb discover scraping. * * @return Redirect */ public function postTmdbDiscover() { $input = Input::except('_token'); if (!($amount = $this->scraper->tmdbDiscover($input))) { return Redirect::back()->withFailure(trans('dash.failed to scrape')); } return Redirect::back()->withSuccess(trans('dash.scraped successfully', array('number' => $amount))); }
/** * Exctract single trailer from tmdb response. * * @return string */ private function trailers() { if (isset($this->raw['videos']['results']) && is_array($this->raw['videos']['results'])) { foreach ($this->raw['videos']['results'] as $video) { if (strtolower($video['type']) === 'trailer' && strtolower($video['site']) === 'youtube') { return $this->youtube . $video['key']; } } } return $this->scraper->getTrailer($this->getTitle(), $this->getReleaseDate()); }
/** * Exctract single trailer from tmdb response. * * @return string */ private function trailers() { if (isset($this->raw['trailers']['youtube'][0]['source'])) { return $this->youtube . $this->raw['trailers']['youtube'][0]['source']; } else { return $this->scraper->getTrailer($this->getTitle(), $this->getReleaseDate()); } }