Ejemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function fetch(FeedInterface $feed, StateInterface $state)
 {
     $sink = $this->generateSink();
     $configuration = $this->getConfiguration();
     $yt_state = ['channel_id' => $feed->getSource(), 'api_key' => $configuration['api_key'], 'import_limit' => $configuration['import_limit'], 'page_limit' => $configuration['page_limit'], 'pageToken' => ''];
     $url = FeedsYoutubeHandler::buildURL($yt_state);
     $response = $this->get($url, $sink, $this->getCacheKey($feed));
     // 304, nothing to see here.
     if ($response->getStatusCode() == Response::HTTP_NOT_MODIFIED) {
         $state->setMessage($this->t('The feed has not been updated.'));
         throw new EmptyFeedException();
     }
     return new HttpFetcherResult($sink, $response->getHeaders());
 }
Ejemplo n.º 2
0
 private function fetchInternal(FeedInterface $feed, array $yt_state)
 {
     $url = FeedsYoutubeHandler::buildURL($yt_state);
     $response = $this->getInternal($url);
     $data = $response->getBody()->getContents();
     return $data;
 }