Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/michaelbelgium/laravel-youtube-api
A way to add an API to your Laravel app that converts youtube video's to mp3/mp4 and returns a download/stream link and information.
https://github.com/michaelbelgium/laravel-youtube-api
laravel laravel-package video-converter youtube youtube-api youtube-dl youtube-downloader
Last synced: about 2 months ago
JSON representation
A way to add an API to your Laravel app that converts youtube video's to mp3/mp4 and returns a download/stream link and information.
- Host: GitHub
- URL: https://github.com/michaelbelgium/laravel-youtube-api
- Owner: MichaelBelgium
- License: mit
- Created: 2020-05-03T20:16:54.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-02-23T00:14:58.000Z (10 months ago)
- Last Synced: 2024-10-12T20:07:54.176Z (2 months ago)
- Topics: laravel, laravel-package, video-converter, youtube, youtube-api, youtube-dl, youtube-downloader
- Language: PHP
- Homepage: https://youtube.michaelbelgium.me
- Size: 128 KB
- Stars: 27
- Watchers: 5
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE.md
Awesome Lists containing this project
README
# Laravel Youtube API
[![Latest Version on Packagist](https://img.shields.io/packagist/v/michaelbelgium/laravel-youtube-api.svg?style=flat-square)](https://packagist.org/packages/michaelbelgium/laravel-youtube-api)
[![Total Downloads](https://img.shields.io/packagist/dt/michaelbelgium/laravel-youtube-api.svg?style=flat-square)](https://packagist.org/packages/michaelbelgium/laravel-youtube-api)This package provides a simple youtube api for your Laravel application. It is based on my non-laravel package [Youtube API](https://github.com/MichaelBelgium/Youtube-to-mp3-API).
## Installation
* Install the package via composer:
```bash
composer require michaelbelgium/laravel-youtube-api
```* Optional: publish the config file and edit if u like:
```bash
php artisan vendor:publish --tag=youtube-api-config
```* This package uses [the public disk](https://laravel.com/docs/8.x/filesystem#the-public-disk) of Laravel. Run this command to create a symbolic link to the public folder so that converted Youtube downloads are accessible:
```bash
php artisan storage:link
```* Execute package migrations
```
php artisan migrate
```* Acquire a Google API key at the [Google Developer Console](https://console.developers.google.com) for the API "Youtube Data API v3". Use this key in the environment variable `GOOGLE_API_KEY` - that this packages uses
# Software
On the server where your laravel app is located, you'll need to install some packages.
* Install ffmpeg (+ libmp3lame - see [this wiki](https://github.com/MichaelBelgium/Youtube-to-mp3-API/wiki/Installing-"ffmpeg"-and-"libmp3lame"-manually) for tutorial)
* [install youtube-dl](http://ytdl-org.github.io/youtube-dl/download.html)# API Usage
This package adds 3 api routes. The route prefix, `/ytconverter/` in this case, is configurable.
* POST|GET /ytconverter/convert
* DELETE /ytconverter/{id}
* GET /ytconverter/searchCheck the wiki page of this repository for more information about the routes.
## API authorization
If needed, you can protect the API routes with an authentication guard by setting `auth` in the configuration.
Example:
```PHP
'auth' => 'sanctum',```
## API rate limiting
If needed, you can limit API calls by editing the config setting `ratelimiter`. See [Laravel docs](https://laravel.com/docs/8.x/routing#rate-limiting) for more information or examples.
Example:
```PHP
'ratelimiter' => function (Request $request) {
return Limit::perMinute(5);
},
```