classes/Video.php
private static function callYoutubedl(array $arguments)
    {
        $config = Config::getInstance();

        $process = self::getProcess($arguments);
        //This is needed by the openload extractor because it runs PhantomJS
        $process->setEnv(['PATH'=>$config->phantomjsDir]);
        $process->inheritEnvironmentVariables();
        $process->run();
        if (!$process->isSuccessful()) {
            $errorOutput = trim($process->getErrorOutput());
            $exitCode = $process->getExitCode();
            if ($errorOutput == 'ERROR: This video is protected by a password, use the --video-password option') {
                throw new PasswordException($errorOutput, $exitCode);
            } elseif (substr($errorOutput, 0, 21) == 'ERROR: Wrong password') {
                throw new Exception(_('Wrong password'), $exitCode);
            } else {
                throw new Exception($errorOutput, $exitCode);
            }
        } else {
            return trim($process->getOutput());
        }
    }
private static function callYoutubedl(array $arguments)
    {
        $config = Config::getInstance();

        $process = self::getProcess($arguments);
        //This is needed by the openload extractor because it runs PhantomJS
        $process->setEnv(['PATH'=>$config->phantomjsDir]);
        $process->inheritEnvironmentVariables();
        $process->run();
        if (!$process->isSuccessful()) {
            $errorOutput = trim($process->getErrorOutput());
            $exitCode = $process->getExitCode();
            if ($errorOutput == 'ERROR: This video is protected by a password, use the --video-password option') {
                throw new PasswordException($errorOutput, $exitCode);
            } elseif (substr($errorOutput, 0, 21) == 'ERROR: Wrong password') {
                throw new Exception(_('Wrong password'), $exitCode);
            } else {
                throw new Exception($errorOutput, $exitCode);
            }
        } else {
            return trim($process->getOutput());
        }
    }
private static function callYoutubedl ( array $ arguments ) { $ config = Config :: getInstance ( ) ; $ process = self :: getProcess ( $ arguments ) ; //This is needed by the openload extractor because it runs PhantomJS $ process -> setEnv ( [ 'PATH' => $ config -> phantomjsDir ] ) ; $ process -> inheritEnvironmentVariables ( ) ; $ process -> run ( ) ; if ( ! $ process -> isSuccessful ( ) ) { $ errorOutput = trim ( $ process -> getErrorOutput ( ) ) ; $ exitCode = $ process -> getExitCode ( ) ; if ( $ errorOutput == 'ERROR: This video is protected by a password, use the --video-password option' ) { throw new PasswordException ( $ errorOutput , $ exitCode ) ; } elseif ( substr ( $ errorOutput , 0 , 21 ) == 'ERROR: Wrong password' ) { throw new Exception ( _ ( 'Wrong password' ) , $ exitCode ) ; } else { throw new Exception ( $ errorOutput , $ exitCode ) ; } } else { return trim ( $ process -> getOutput ( ) ) ; } }
Call youtube-dl.

@param array $arguments Arguments

@throws PasswordException If the video is protected by a password and no password was specified
@throws Exception         If the password is wrong
@throws Exception         If youtube-dl returns an error

@return string Result
Call youtube - dl .