CentOS 6 / Plesk 10専用サーバーにyoutube-dlをインストールしましたが、SSH経由ですべてが魅力のように機能します。
サーバーにコピーしたいビデオのURLを含むPOSTパラメーターを取り、それをコピーしてからffmpegで処理するphpスクリプトを作成しようとしています。
exec()関数を使うと思いました。
の結果をエコーすると出力を取得できますが、youtube-dl --help
phpにビデオで実際に何かを実行するコマンドを実行するように要求するたびに、ステータス「1」が返され、何も出力されません。
私が間違っていることについて何か考えはありますか?
これが私のphpコードです:
<?php
$result = array();
$status;
$url = $_POST['src'];
$string = 'youtube-dl "'.$url.'" -f 18 -o "/var/www/vhosts/my.virtual.host.net/httpdocs/downloader/downloads/%(id)s.%(ext)s"';
$string2 = 'youtube-dl --help';
exec($string, $result, $status);
echo json_encode(array('status' => $status, 'url_orginal'=>$url, 'url' => $result));
?>
$ string2を実行すると、ステータスが「0」と「url」になります。[youtube-dlヘルプテキスト行]
しかし、$ stringを実行しても何も起こらず、「status」:「1」が表示され、それ以外は何もダウンロードされません。「-g」パラメータとバリアントを使用したシミュレーションも試しましたが、youtube-dlがビデオをフェッチする必要があるとすぐに、壊れます。
前もって感謝します !
編集
コードを編集したので、次のようになります。
<?php
$result = array();
$status;
$url = $_POST['src'];
$string = 'youtube-dl "'.$url.'" -f 18 -o "/var/www/vhosts/my.virtual.host.net/httpdocs/downloader/downloads/%(id)s.%(ext)s"';
$string2 = 'youtube-dl --help';
exec($string, $result, $status);
echo json_encode(array('status' => $status, 'url_orginal'=>$url, 'url' => $result, 'command' => $string));
?>
昨日得られなかった結果は次のとおりです。
command: "youtube-dl "http://www.youtube.com/watch?v=coq9klG41R8" -f 18 -o "/var/www/vhosts/my.virtual.host.net/httpdocs/downloader/downloads/%(id)s.%(ext)s""
status: 1
url:
0: "[youtube] Setting language"
1: "[youtube] coq9klG41R8: Downloading video info webpage"
2: "[youtube] coq9klG41R8: Extracting video information"
url_orginal: "http://www.youtube.com/watch?v=coq9klG41R8"
これは奇妙なことです。a)昨日空のurl []を取得し、b)通常のyoutube-dlリターンのように見えるものを取得したとしても、最初の3行しか含まれておらず、何も表示されません。指定されたパスのビデオファイル...何かアイデアはありますか?