mokhosh/laravel-youtube-downloader

在您的Laravel应用程序中下载YouTube视频(当然是为了个人和教育用途)

v1.0.0 2023-12-10 14:47 UTC

This package is auto-updated.

Last update: 2024-09-08 10:51:29 UTC


README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

安装

您可以通过Composer安装此包

composer require mokhosh/laravel-youtube-downloader

使用

use Mokhosh\Facades\LaravelYoutubeDownloader;

$videoId = LaravelYoutubeDownloader::getVideoIdFromUrl($youtubeUrl);
$video = LaravelYoutubeDownloader::getYoutubeVideoMeta($videoId);

$formats = $video->streamingData->formats;
$adaptiveFormats = $video->streamingData->adaptiveFormats;

$title = $video->videoDetails->title;
$short_description = $video->videoDetails->shortDescription;
$thumbnails = $video->videoDetails->thumbnail->thumbnails;
$thumbnail = end($thumbnails)->url;
$channel_id = $video->videoDetails->channelId;
$channel_name = $video->videoDetails->author;
$views = $video->videoDetails->viewCount;
$video_duration_in_seconds = $video->videoDetails->lengthSeconds;

测试

composer test

变更日志

有关最近更改的更多信息,请参阅变更日志

贡献

有关详细信息,请参阅贡献指南

安全漏洞

有关如何报告安全漏洞的详细信息,请参阅我们的安全策略

鸣谢

许可

MIT许可(MIT)。有关更多信息,请参阅许可文件