我正在尝试编写一个Python脚本,用于从youtube下载视频,为此,我尝试使用。但是,当我在他们的github页面上的python脚本中插入代码时,应该嵌入代码
from __future__ import unicode_literals
import youtube_dl
ydl_opts = {}
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
ydl.download(['https://www.youtube.com/watch?v=BaW_jenozKc'])
我的终端输出'ImportError: No
当通过cron运行时,我的日志显示:
/home/myhomepath/bashscript.sh: line 5: youtube-dl: command not found
我使用crontab输入的条目(注意:使用crontab -e输入条目,运行脚本的间隔只是出于示例目的而虚构的)
*/1 * * * * /home/myhomepath/bashscript.sh
在我的bash脚本中,我尝试在顶部使用以下内容:
#!/usr/bin/env bash and also #!/usr/bin/bash but neither resolve the issue
我通过以下代码调用脚
我有一个可以在离线情况下部署的页面,并希望处理屏幕上特定容器中的youtube视频播放。我不想从youtube加载iframe_api,直到它需要,因为它有很大的可能不会。
function EmbedAndPlay_Youtube(videoid, container) {
// todo: allow script caching
$.getScript("//www.youtube.com/iframe_api")
.fail(function () {
// some kind of alert to the user ...
})
我正在开发一个脚本,该脚本使用Curl从youtube获取标题和id,并将它们保存到具有以下结构的数据库中:id_ title _ id_youtube _ date。
问题是,我需要一个代码,以便如果标题已经存在于db中,显示来自DB的内容,否则就会卷曲来处理它并将其存储在db中。
id_youtube($q); // this function get the id_youtube
title_youtube($q); // this function get the youtube title
$id = id_youtube($q);
$q = title_youtube($q);