Proxy\Plugin\YoutubePlugin::youtube_dl PHP Method

youtube_dl() private method

will return empty if youtube-dl not installed
private youtube_dl ( )
    private function youtube_dl()
    {
        $result = array();
        $start = microtime(true);
        // --get-url
        // --dump-single-json
        $cmd = sprintf('youtube-dl -J %s', escapeshellarg($this->youtube_url));
        exec($cmd, $output, $ret);
        $end = microtime(true);
        if ($ret == 0) {
            $json = json_decode($output[0], true);
            // formats
            $formats = $json['formats'];
            foreach ($formats as $vid) {
                $result[$vid['format_id']] = $vid['url'];
            }
        }
        return $result;
    }