2017 © Pedro Peláez
 

library youtube-dl-php

youtube-dl wrapper for php

image

bilalghouri/youtube-dl-php

youtube-dl wrapper for php

  • Wednesday, January 6, 2016
  • by bilalghouri
  • Repository
  • 1 Watchers
  • 0 Stars
  • 11 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 38 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Note

Please use the original repository youtube-dl-php, this is a customized fork., (*1)

Youtube-dl PHP

A PHP wrapper for youtube-dl tool., (*2)

Latest Stable Version Latest Unstable Version StyleCI License, (*3)

Install

First step is to download the youtube-dl and add it's path to environment variables., (*4)

Second step is to install the wrapper using Composer:, (*5)

composer require norkunas/youtube-dl-php

Example

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

use YoutubeDl\YoutubeDl;
use YoutubeDl\Exception\CopyrightException;
use YoutubeDl\Exception\NotFoundException;
use YoutubeDl\Exception\PrivateVideoException;

$dl = new YoutubeDl([
    'continue' => true, // force resume of partially downloaded files. By default, youtube-dl will resume downloads if possible.
    'format' => 'bestvideo',
]);
// For more options go to https://github.com/rg3/youtube-dl#user-content-options

$dl->setDownloadPath('/home/user/downloads');
// Enable debugging
/*$dl->debug(function ($type, $buffer) {
    if (\Symfony\Component\Process\Process::ERR === $type) {
        echo 'ERR > ' . $buffer;
    } else {
        echo 'OUT > ' . $buffer;
    }
});*/
try {
    $video = $dl->download('https://www.youtube.com/watch?v=oDAw7vW7H0c');
    echo $video->getTitle(); // Will return Phonebloks
    // $dl->getFile(); // \SplFileInfo instance of downloaded file
} catch (NotFoundException $e) {
    // Video not found
} catch (PrivateVideoException $e) {
    // Video is private
} catch (CopyrightException $e) {
    // The YouTube account associated with this video has been terminated due to multiple third-party notifications of copyright infringement
} catch (\Exception $e) {
    // Failed to download
}

Disabled options which would break download:, (*6)

list-formats, list-subs, list-thumbnails, get-url, get-title, get-id, get-thumbnail, get-description, get-duration, get-filename, get-format, dump-json, dump-single-json, print-json (used internally), newline, no-progress, console-title, verbose, dump-pages, write-pages, print-traffic, ignore-config (used internally)., (*7)

The Versions

06/01 2016

dev-master

9999999-dev

youtube-dl wrapper for php

  Sources   Download

MIT

The Requires

 

The Development Requires

by Tomas

youtube youtube-dl

16/07 2015

v0.1.3

0.1.3.0

youtube-dl wrapper for php

  Sources   Download

MIT

The Requires

 

The Development Requires

by Tomas

youtube youtube-dl

28/05 2015

v0.1.2

0.1.2.0

youtube-dl wrapper for php

  Sources   Download

MIT

The Requires

 

The Development Requires

by Tomas

youtube youtube-dl

04/04 2015

v0.1

0.1.0.0

youtube-dl wrapper for php

  Sources   Download

MIT

The Requires

 

The Development Requires

by Tomas

youtube youtube-dl