smoqadam/youtube-video-info
Composer 安装命令:
composer require smoqadam/youtube-video-info
包简介
README 文档
README
Get the information about a youtube video
Installation
$ composer require smoqadam/youtube-video-info:dev-master
Usage
it's so easy to get the information about a youtueb's video. Let's say we need to fetch the caption for a spicific video:
<?php use Smoqadam; use Smoqadam\Response\Entity\Subtitle; ini_set('display_errors', 'On'); require_once 'vendor/autoload.php'; $videoId = 'VVx6ntr5OqI'; $video = new Video($videoId); $captions = $video->getCaptions('en'); /** @var Subtitle $caption */ foreach ($captions as $caption) { echo $caption->getText(); echo '<br>'; echo $caption->getStart(); echo '<br>'; echo $caption->getDuration(); echo '<br>'; echo '<hr>' }
Let's get the formats for that video:
$formats = $video->getFormats(); /** @var Format $format */ foreach ($formats as $format) { echo $format->getUrl(); echo $format->getMimeType(); echo $format->getWidth(); echo $format->getHeight(); echo $format->getSize(); // in bytes echo $format->getQuality(); echo $format->getFps(); echo '<br>'; }
And finally, let's get some details about the video:
$details = $video->getDetails(); echo $details->getVideoId(); echo $details->getTitle(); echo $details->getThumbnails(); echo $details->getViewCount(); echo $details->getRating();
统计信息
- 总下载量: 566
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 10
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2019-12-19