smartvain / youtube-caption-displayer
This package allows you to get subtitles from youtube.
1.0.0
2022-07-12 13:37 UTC
Requires
- php: ^7.3|^8.0
- guzzlehttp/guzzle: ^7.0.1
- laravel/framework: ^8.75
This package is auto-updated.
Last update: 2025-07-12 22:21:47 UTC
README
You can install it by typing the following command in a terminal.
$ composer require smartvain/youtube-caption-displayer # or composer require --dev
Install with Packagist
Prepared methods
- getLangList()
- getCaptionsWithSeconds()
- getCaptionText()
Usage
First, add a Use declaration anywhere.
use Smartvain\YoutubeCaptionDisplayer\Displayer;
All that remains is to call the method with Facade.
Get the language list used for youtube video subtitles with getLangList()
.
Next, since the obtained language list contains lang-code, use it to get subtitles by getCaptionsWithSeconds()
or getCaptionText()
.
If it is a youtube video without subtitles, return empty Collection.
It's so easy.