albertkampde/youtube-downloader

PHP 库,用于从 YouTube 下载视频

v1.0.2 2016-02-23 22:59 UTC

This package is not auto-updated.

Last update: 2024-09-23 07:16:31 UTC


README

Build Status Scrutinizer Code Quality License

这个库是 Youtube-dl 的 PHP 实现,用于从 YouTube 和其他网站下载视频。

安装

Youtube-dl 必须先安装。

使用 Composer 安装

{
    "require": {
        "albertkampde/youtube-downloader": "dev-master"
    }
}

示例

下载

use Youtubedl\Youtubedl;

$youtubedl=new Youtubedl();
$youtubedl->getOption()
          ->setOutput("\"/tmp/%(title)s.%(ext)s\"");
$youtubedl->download('BaW_jenozKc')
          ->execute();

批量下载

use Youtubedl\Youtubedl;

$youtubedl=new Youtubedl();
$youtubedl->getOption()
          ->setOutput("\"/tmp/%(title)s.%(ext)s\"");
$youtubedl->download(array('BaW_jenozKc','dOibtqWo6z4'))
          ->execute();

提取器列表

use Youtubedl\Youtubedl;

$youtubedl=new Youtubedl();
$youtubedl->getOption()
          ->getListExtractors();
echo $youtubedl->execute();

提取器描述

use Youtubedl\Youtubedl;

$youtubedl=new Youtubedl();
$youtubedl->getOption()
          ->getExtractorDescriptions();
echo $youtubedl->execute();

用户代理

use Youtubedl\Youtubedl;

$youtubedl=new Youtubedl();
$youtubedl->getOption()
          ->setUserAgent('Opera/9.80 (Windows NT 6.0) Presto/2.12.388 Version/12.14')
          ->dumpUserAgent();
echo $youtubedl->execute();