burakerenel/devtube
Composer 安装命令:
composer require burakerenel/devtube
包简介
A Laravel package for downloading videos from the net by simply passing a URL
关键字:
README 文档
README
Install FFMPEG only if you want to convert videos to mp3 etc
Ubuntu:
sudo apt install ffmpeg
Install youtube-dl
sudo apt install youtube-dl
Install via composer
composer require devswebdev/devtube
Publish vendor assets
php artisan vendor:publish --provider="DevsWebDev\DevTube\DevTubeServiceProvider"
This publishes a devtube.php file in your config/ directory
Please set your default options there.
Make sure your youtube-dl path is correct by comparing the output of which youtube-dl to the bin_path in devtube.php
"bin_path" => "/usr/bin/youtube-dl",
An Example
namespace App\Http\Controllers; use DevsWebDev\DevTube\Download; class YoutubeDownloadController extends Controller { public function download() { $dl = new Download($url = "https://www.youtube.com/watch?v=ye5BuYf8q4o", $format = "mp4", $download_path = "music" ); //Saves the file to specified directory $media_info = $dl->download(); $media_info = $media_info->first(); // Return as a download return response()->download($media_info['file']->getPathname()); } }
Or in your web.php routes file
use DevsWebDev\DevTube\Download; Route::get('/', function () { $dl = new Download($url = "https://www.youtube.com/watch?v=ye5BuYf8q4o", $format = "mp3", $download_path = "music" ); //Saves the file to specified directory $media_info = $dl->download(); $media_info = $media_info->first(); // Return as a download return response()->download($media_info['file']->getPathname()); });
统计信息
- 总下载量: 6
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-03-30