fetch youtube videos by youtube data api

1.0.0 2021-03-18 04:02 UTC

This package is auto-updated.

Last update: 2024-04-18 11:04:52 UTC


README

Install

composer require exinfinite/ytc

Usage

初始化

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

取得清單中影片

Reference:https://developers.google.com/youtube/v3/docs/playlistItems

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

Roadmap

  • PlaylistItems
  • Playlists
  • Videos