efremovp/yii2-youtube-helper

Скачиваем видео с канала YouTube с помощью API. Для дальнейшего сохранения ссылок на видео в своей БД. И вывода их на сайт.

v1.0.4 2024-10-15 11:43 UTC

This package is auto-updated.

Last update: 2025-03-15 12:33:38 UTC


README

Скачиваем все видео с плейлиста YouTube с помощью API. Для дальнейшего сохранения ссылок на видео в своей БД. И вывода их на сайт.

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require efremovp/yii2-youtube-helper "*"

or add

"efremovp/yii2-youtube-helper": "*"

to the require section of your composer.json file.

Usage

Once the extension is installed, simply use it in your code by :

use efremovP\youtube\ApiYouTube;


$youtube = new ApiYouTube('Youtube_Api_Key');

$id_youtube_playlist = 'PLdmSK1Qzu984Jnm_YhDcD_Hs5WEB39HoR';
// скачать список видео плейлиста
$video_list = $youtube->getList($id_youtube_playlist);


$key_video = '7JHQ83gho6E';

// получаем массив всех данных на видео
$image_url = $youtube->getImage($key_video);

// получаем иконку на видео
$image_url = $youtube->getImage($key_video);

//дату публикации на видео в формате YYYY-MM-DD HH:MM:SS
$image_url = $youtube->getPublishDate($key_video);