Download the PHP package flatgreen/ytdl without Composer
On this page you can find all versions of the php package flatgreen/ytdl. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download flatgreen/ytdl
More information about flatgreen/ytdl
Files in flatgreen/ytdl
Package ytdl
Short Description A PHP wrapper for youtube-dl or yt-dlp tool. Close to the command line, with a caching system.
License MIT
Informations about the package ytdl
Ytdl
PHP wrapper for youtube-dl or yt-dlp.
Two goals:
- be close to the command line of youtube-dl
- minimize requests, while having the maximum amount of information
Prerequisites
- php >= 7.4
- youtube-dl or yt-dlp
- Strongly recommended: ffmpeg. See yt-dlp dependencies
Installation
-
Use the package manager composer to install Ytdl.
- Optional: Create a 'cache' directory (with read|write permissions), by default the cache directory is inside the system temporary directory.
Usage
Load the two classes:
Define the options:
All in array manner. No URL here.
see : options for youtube-dl or options for yt-dlp
Instantiate and extract information:
Instantiate the class:
If you want to set the ytdl executable path, you need to pass the value like below. This will skip the automatic scan (in PATH) of the executable. It is your responsibility to set this path correctly.
Define a video url:
Read the video informations
With some format (like ['-f' => 'bv*+ba']), there is no $info_dict['url'], but the media can be downloaded with this $info_dict.
At this moment, $info_dict is in the cache.
Download a video
Examples
- example-0 with just '--version' option
- example-1 extract example
- example-1-1 extract from a playlist
- example-2 download a video (cache and download folders)
- example-2-2 download with a change of options
- example-3 download a playlist (no cache, not optimal)
- example-4 extract all informations from a playlist and download some videos with cache system.
Versions
See CHANGELOG
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
License
ytdl is licensed under the MIT License (MIT). Please see the license file for more information.
All versions of ytdl with dependencies
symfony/process Version ^5|^6|^7
psr/log Version ^1|^2|^3
symfony/cache Version ^5|^6|^7