All Projects → norkunas → Youtube Dl Php

norkunas / Youtube Dl Php

Licence: mit
Youtube-dl wrapper for PHP

Projects that are alternatives of or similar to Youtube Dl Php

URTube
URTube, a YouTube video to MP3 downloader built in NodeJs and Electron
Stars: ✭ 20 (-92.65%)
Mutual labels:  youtube-dl
podpodge
Convert YouTube playlists to audio-only RSS feeds for podcast apps to consume.
Stars: ✭ 32 (-88.24%)
Mutual labels:  youtube-dl
SharpGrabber
Download from YouTube, Vimeo, PornHub, HLS (M3U8 files) with .NET and JavaScript, Library and desktop app for downloading high quality media
Stars: ✭ 138 (-49.26%)
Mutual labels:  youtube-dl
tgmusicbot
Telegram bot for downloading audio from YouTube, SoundCloud & MixCloud.
Stars: ✭ 66 (-75.74%)
Mutual labels:  youtube-dl
YouTube-Downloader
No description or website provided.
Stars: ✭ 34 (-87.5%)
Mutual labels:  youtube-dl
MIRROR-HUNTER
Who are we? We are the Hunters of all Torrent in this world.🗡️.Fork from SlamDevs
Stars: ✭ 86 (-68.38%)
Mutual labels:  youtube-dl
TwitterMediaDownloader
downloads photos and videos from twitter
Stars: ✭ 15 (-94.49%)
Mutual labels:  youtube-dl
spongebob-cli
Watch classic spongebob from the terminal!
Stars: ✭ 179 (-34.19%)
Mutual labels:  youtube-dl
ytqck.github.io
YouTube quick ⚡ Search and Download Music for Free.
Stars: ✭ 18 (-93.38%)
Mutual labels:  youtube-dl
yayd
youtube-dl backend in Rust, aka youtube & co downloader
Stars: ✭ 32 (-88.24%)
Mutual labels:  youtube-dl
slam-mirrorbot
Aria/qBittorrent Telegram mirror/leech bot.
Stars: ✭ 1,072 (+294.12%)
Mutual labels:  youtube-dl
download audioset
📁 This repo makes it easy to download the raw audio files from AudioSet (32.45 GB, 632 classes).
Stars: ✭ 53 (-80.51%)
Mutual labels:  youtube-dl
Pantheon
The fastest YouTube downloader.
Stars: ✭ 32 (-88.24%)
Mutual labels:  youtube-dl
aws-lambda-youtube-dl
Download YouTube (and a few other sites) videos to S3 using Lambda.
Stars: ✭ 78 (-71.32%)
Mutual labels:  youtube-dl
ypc
Convert text/spotify/deezer albums/playlists to youtube urls and audio/video files.
Stars: ✭ 17 (-93.75%)
Mutual labels:  youtube-dl
YouTube-Downloader
Django YouTube Downloader Using youtube-dl
Stars: ✭ 47 (-82.72%)
Mutual labels:  youtube-dl
mpv-youtube-download
A userscript for MPV that allows you to download youtube audio and video with one key press 💾
Stars: ✭ 16 (-94.12%)
Mutual labels:  youtube-dl
Youtube Dl Webui
Another webui for youtube-dl powered by Flask.
Stars: ✭ 254 (-6.62%)
Mutual labels:  youtube-dl
red
Red - Privacy focused Youtube player and download manager for Linux
Stars: ✭ 27 (-90.07%)
Mutual labels:  youtube-dl
video-dl
Video Downloader 📥 - Download Facebook Video and Youtube Video and Audio.
Stars: ✭ 13 (-95.22%)
Mutual labels:  youtube-dl

Youtube-dl PHP

A PHP wrapper for youtube-dl tool.

Latest Stable Version Latest Unstable Version Total Downloads CI Status License

Install

First step is to download the youtube-dl.

Second step is to install the wrapper using Composer:

composer require norkunas/youtube-dl-php:dev-master

Download video

<?php

declare(strict_types=1);

require __DIR__ . '/vendor/autoload.php';

use YoutubeDl\Options;
use YoutubeDl\YoutubeDl;

$yt = new YoutubeDl();

$collection = $yt->download(
    Options::create()
        ->downloadPath('/path/to/downloads')
        ->url('https://www.youtube.com/watch?v=oDAw7vW7H0c')
);

foreach ($collection->getVideos() as $video) {
    if ($video->getError() !== null) {
        echo "Error downloading video: {$video->getError()}.";
    } else {
        echo $video->getTitle(); // Will return Phonebloks
        // $video->getFile(); // \SplFileInfo instance of downloaded file
    }
}

Download only audio (requires ffmpeg or avconv and ffprobe or avprobe)

<?php

declare(strict_types=1);

require __DIR__ . '/vendor/autoload.php';

use YoutubeDl\Options;
use YoutubeDl\YoutubeDl;

$yt = new YoutubeDl();
$collection = $yt->download(
    Options::create()
        ->downloadPath('/path/to/downloads')
        ->extractAudio(true)
        ->audioFormat('mp3')
        ->audioQuality(0) // best
        ->output('%(title)s.%(ext)s')
        ->url('https://www.youtube.com/watch?v=oDAw7vW7H0c')
);

foreach ($collection->getVideos() as $video) {
    if ($video->getError() !== null) {
        echo "Error downloading video: {$video->getError()}.";
    } else {
        $video->getFile(); // audio file
    }
}

Download progress

<?php

declare(strict_types=1);

require __DIR__ . '/vendor/autoload.php';

use YoutubeDl\YoutubeDl;

$yt = new YoutubeDl();
$yt->onProgress(static function (string $progressTarget, string $percentage, string $size, string $speed, string $eta, ?string $totalTime): void {
    echo "Download file: $progressTarget; Percentage: $percentage; Size: $size";
    if ($speed) {
        echo "; Speed: $speed";
    }
    if ($eta) {
        echo "; ETA: $eta";
    }
    if ($totalTime !== null) {
        echo "; Downloaded in: $totalTime";
    }
});

Custom Process Instantiation

<?php

declare(strict_types=1);

namespace App\YoutubeDl;

use Symfony\Component\Process\Process;
use YoutubeDl\Process\ProcessBuilderInterface;

class ProcessBuilder implements ProcessBuilderInterface
{
    public function build(?string $binPath, ?string $pythonPath, array $arguments = []): Process
    {
        $process = new Process([$binPath, $pythonPath, ...$arguments]);
        // Set custom timeout or customize other things..
        $process->setTimeout(60);

        return $process;
    }
}
<?php

declare(strict_types=1);

use App\YoutubeDl\ProcessBuilder;
use YoutubeDl\YoutubeDl;

$processBuilder = new ProcessBuilder();

// Provide your custom process builder as the first argument.
$yt = new YoutubeDl($processBuilder);
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].