通过YouTube数据API获取YouTube视频

1.0.0 2021-03-18 04:02 UTC

This package is auto-updated.

Last update: 2024-09-18 11:46:27 UTC


README

安装

composer require exinfinite/ytc

用法

初始化

use Exinfinite\YTC\Agent;
use Exinfinite\YTC\PlaylistItems;
$apikey = "api-key";
$agent = new Agent($apikey, __DIR__ . '/cache');
$fetcher = new PlaylistItems($agent);

获取列表中视频

参考:https://developers.google.com/youtube/v3/docs/playlistItems

$playlistID = 'playlistID';
$data = $fetcher
        ->setPart(['snippet'])
        ->setPlaylistId($playlistID)
        ->setMaxResults(10)
        ->query(false);//true:ignore cache

路线图

  • 播放列表项
  • 播放列表
  • 视频