Move Video class to a separate library

+ improve error handling
+ youtube-dl update
This commit is contained in:
Pierre Rudloff 2020-06-21 01:44:20 +02:00
parent 7d94271a49
commit 5c2823e3f1
30 changed files with 649 additions and 1152 deletions

View file

@ -148,32 +148,8 @@ so that it points to your ffmpeg/avconv binary (`/usr/bin/avconv` on Debian/Ubun
## Use as library
AllTube can also be used as a library to extract a video URL from a webpage.
You can install it with:
```bash
composer require rudloff/alltube
```
You can then use it in your PHP code:
```php
use Alltube\Config;
use Alltube\Video;
require_once __DIR__.'/vendor/autoload.php';
Config::setOptions(
[
'youtubedl' => '/usr/local/bin/youtube-dl',
]
);
$video = new Video('https://www.youtube.com/watch?v=dQw4w9WgXcQ');
$video->getUrl();
```
You can also have a look at this [example project](https://github.com/Rudloff/alltube-example-project).
The `Video` class is now available as [a separate package](https://packagist.org/packages/rudloff/alltube-library)
so that you can reuse it in your projects.
## JSON API