exinfinite / ytc
fetch youtube videos by youtube data api
1.0.0
2021-03-18 04:02 UTC
Requires
- php: ~5.6.0
- guzzlehttp/guzzle: ^6.5
- phpfastcache/phpfastcache: ^6.1
- tightenco/collect: ^5.4
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