it-tech/youtubeparser

YouTube 频道解析器

v1.0.2 2020-08-21 16:28 UTC

This package is auto-updated.

Last update: 2024-09-29 05:29:14 UTC


README

YouTube 视频解析器将允许您轻松选择任何频道的视频信息。这些信息将包含视频标题、描述、ID 等数据。

安装

在你的文件中连接 composer

composer require it-tech/youtubeparser

连接 vendor/autoload.php

use ITTechnology\Tube\YouTubeParse;

// Initialize application
$tube    = YouTubeParse::init("Your YouTube API key", 30);

// Get channel
$chanel = $tube->chanel('YouTube channel ID');
echo '<h1>Channel '.$chanel->items[0]->snippet->title.'</h1>';
echo "<pre>";
print_r($chanel);
echo "</pre>";

// Get channel playlists
$playlist = $tube->playlists("YouTube channel ID");
echo '<h1>Channel playlists '.$playlist->items[0]->snippet->channelTitle.'</h1>';
echo "<pre>";
print_r($playlist);
echo "</pre>";

echo '<h1>Playlist video '.$playlist->items[0]->snippet->title.'</h1>';

// Get video playlists
$video = $tube->video($playlist->items[0]->id);
echo "<pre>";
print_r($video);
echo "</pre>";