【发布时间】:2014-03-28 15:07:03
【问题描述】:
Traceback(最近一次调用最后一次):文件“/usr/bin/youtube-dl”,行 3、在导入youtube_dl文件 “/usr/lib/python2.7/dist-packages/youtube_dl/init.py”,第 65 行,在 从 .utils 导入(文件 “/usr/lib/python2.7/dist-packages/youtube_dl/utils.py”,第 18 行,在 在 import _ssl 中导入 ssl 文件“/usr/lib/python2.7/ssl.py”,第 61 行 #如果我们不能导入它,让错误传播 ImportError: /usr/lib/python2.7/lib-dynload/_ssl.x86_64-linux-gnu.so: symbol GENERAL_NAME_free,版本 OPENSSL_1.0.0 未在文件中定义 libcrypto.so.1.0.0 与链接时间参考
我使用的命令
youtube-dl --max-quality 2180 --write-thumbnail -x --audio-format mp3 -c -o "/home/bahaa/%(id)s.%(ext)s" https://www.youtube.com/watch?v=xFQFMSNZW08&list=RDV-jLo0Ovems
我正在使用的 php 代码
<?php
$url = 'https://www.youtube.com/watch?v=xFQFMSNZW08&list=RDV-jLo0Ovems';
//escapeshellarg
$string = ('youtube-dl --max-quality 2180 --write-thumbnail -x --audio-format mp3 -c -o "/home/bahaa/%(id)s.%(ext)s" https://www.youtube.com/watch?v=xFQFMSNZW08&list=RDV-jLo0Ovems');
$descriptorspec = array(
0 => array("pipe", "r"), // stdin
1 => array("pipe", "w"), // stdout
2 => array("pipe", "w"), // stderr
);
$process = proc_open($string, $descriptorspec, $pipes);
$stdout = stream_get_contents($pipes[1]);
fclose($pipes[1]);
$stderr = stream_get_contents($pipes[2]);
fclose($pipes[2]);
$ret = proc_close($process);
echo json_encode(
array(
'status' => $ret,
'errors' => str_replace("\n", "<br />", $stderr."<hr />"),
'output' => $stdout,
)
);
?>
【问题讨论】:
-
直接从命令行调用
youtube-dl是否也出现同样的错误? -
不,我不能正常工作
标签: php python ubuntu ssl xampp