API YouTube — получить информацию о канале из одного видео

Я пытаюсь получить информацию о канале из одного видео на YouTube через их API, используя php, а также информацию о канале.

Мой код:

private function getYoutubePosts(){
$timelines = array();

for ($a = 0; $a < count($this->youtube_sources['users']); ++$a) {

//ChannelId
$channelId = false;
if (strlen($this->youtube_sources['users'][$a]) == '24') {
$channelId = $this->youtube_sources['users'][$a];
} else {
//Get the channelId
$channel_info = $this->curlCall('https://www.googleapis.com/youtube/v3/channels?part=snippet&forUsername='.$this->youtube_sources['users'][$a].'&maxResults=1&fields=items%2Fid&key='.$this->youtube_sources['app_secret']);
$channelId = $channel_info->items[0]->id;
}
//Videos
if ($channelId) {
$user_posts = $this->curlCall('https://www.googleapis.com/youtube/v3/search?part=snippet&type=video&order=date&channelId='.$channelId.'&key='.$this->youtube_sources['app_secret']);
if (isset($user_posts->items)) {
array_push($timelines, $user_posts->items);

}
}
}

return $timelines;

Получение данных. Что я должен изменить, чтобы я мог получить также миниатюру канала?

    for ($i = 0; $i < count($youtube_timelines); ++$i) {
$timeline = $youtube_timelines[$i];
if ($a < count($timeline)) {
$post = $timeline[$a];
array_push($blended_timelines, array(
'source' => 'youtube',
'username' => $post->snippet->channelTitle,
'id' => $post->id->videoId,
'link' => 'https://www.youtube.com/watch?v='.$post->id->videoId,
'timestamp' => (int) strtotime($post->snippet->publishedAt),
'created_time' => date('d M Y', strtotime($post->snippet->publishedAt)),
'text' => $post->snippet->description,
'image' => $post->snippet->thumbnails->high->url,

'author_picture' => $???,)

Уже прочитал https://developers.google.com/youtube/v3/docs/videos/list & https://developers.google.com/youtube/v3/docs/channels/list несколько раз.

Я хотел бы получить также эскиз канала «для отображения. Я что-то пропускаю или пропускаю?

0

Решение

Задача ещё не решена.

Другие решения

Других решений пока нет …

По вопросам рекламы ammmcru@yandex.ru
Adblock
detector