Download the PHP package michaelbelgium/laravel-youtube-api without Composer
On this page you can find all versions of the php package michaelbelgium/laravel-youtube-api. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download michaelbelgium/laravel-youtube-api
More information about michaelbelgium/laravel-youtube-api
Files in michaelbelgium/laravel-youtube-api
Package laravel-youtube-api
Short Description Add a youtube api to your Laravel instance
License MIT
Homepage https://github.com/michaelbelgium/laravel-youtube-api
Informations about the package laravel-youtube-api
Laravel Youtube API
This package provides a simple youtube api for your Laravel application. It is based on my non-laravel package Youtube API.
Installation
-
Install the package via composer:
-
Optional: publish the config file and edit if u like:
-
This package uses the public disk of Laravel. Run this command to create a symbolic link to the public folder so that converted Youtube downloads are accessible:
- Execute package migrations
Software
Depending on what driver you use - on the server where your laravel app is located, you'll need to install some packages.
- Install ffmpeg (+ libmp3lame - see this wiki for tutorial)
- install youtube-dl
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/search
Check the wiki page of this repository for more information about the routes.
To enable the search endpoint you need to acquire a Google API key on the Google Developer Console for the API "Youtube Data API v3". Use this key in the environment variable GOOGLE_API_KEY
Configuration
Driver
Downloading Youtube video's is not simple these days. To cover this, you can choose how you want to download the video's by setting the driver
in the configuration.
Available drivers:
- local
The default driver. Requires ffmpeg and yt-dlp or youtube-dl to be installed on the server and it'll download files to the server. Metadata comes from yt-dlp.
- cobalt
Requires a self hosted Cobalt (API) instance. It doesn't require any software to be installed on the server and it doesn't download files to the server.
If GOOGLE_API_KEY
is set, it'll use the Youtube Data API to get metadata, otherwise it'll download the video to get the metadata and thus use storage space instead.
API authorization
If needed, you can protect the API routes with an authentication guard by setting auth
in the configuration.
Example:
API rate limiting
If needed, you can limit API calls by editing the config setting ratelimiter
. See Laravel docs for more information or examples.
Example:
All versions of laravel-youtube-api with dependencies
illuminate/support Version ^8.0|^9.0|^10.0
james-heinrich/getid3 Version ^1.9
norkunas/youtube-dl-php Version ^2.0