Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/devinnorgarb/devtube

Laravel YouTube and Online Video viewing and download interface.
https://github.com/devinnorgarb/devtube

laravel laravel-5-package laravel-package laravel5 mp3 mp3-converter mp4 php video-downloader youtube-dl youtubedownloader

Last synced: 6 days ago
JSON representation

Laravel YouTube and Online Video viewing and download interface.

Awesome Lists containing this project

README

        

## Install DevTube Video Downloader

Install FFMPEG only if you want to convert videos to mp3 etc

Ubuntu:

```bash
sudo apt install ffmpeg
```

Install `youtube-dl`

```bash
sudo apt install youtube-dl
```

Install via composer

```bash
composer require devswebdev/devtube
```

Publish vendor assets

```bash
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`

```php
"bin_path" => "/usr/bin/youtube-dl",
```

An Example

```php

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

```php
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());

});

```