我在Internet上找到了一个脚本(https://calomel.org/youtube_wget.html),可以wgets youtube视频。
因此,该脚本可通过简单键入./yt.pl youtubeLink
完美地适用于单个剪辑。但是我想将其扩展并从文本文档中的链接中使用(download.txt)。因此,我在Bash中创建了一个循环。循环看起来像这样。
`
#!/bin/bash
wordCount=$(cat download.txt | wc -l)
for (( number=$wordCount; $number-lt$wordCount;number--))
do
link=$(sed -n $number"p" download.txt)
"./yt.pl "$link
sleep 3
done
唯一的问题是行不通的。它给我以下错误消息。
/auto.sh: line 7: ./yt.pl http://www.youtube.com/watch?v=KYzUd95h8X4: No such file or directory
如果我只是运行错误消息的这一部分./yt.pl http://www.youtube.com/watch?v=KYzUd95h8X4
它可以正常工作。
这是SSH窗口的完整输出
./auto.sh: line 7: ./yt.pl : No such file or directory
./auto.sh: line 7: ./yt.pl http://www.youtube.com/watch?v=XEAL23g2V6g: No such file or directory
./auto.sh: line 7: ./yt.pl http://www.youtube.com/watch?v=KYzUd95h8X4: No such file or directory
./auto.sh: line 7: ./yt.pl http://www.youtube.com/watch?v=IaADyDhg-CY: No such file or directory
./auto.sh: line 7: ./yt.pl http://www.youtube.com/watch?v=JmY4RCCCll4: No such file or directory
./auto.sh: line 7: ./yt.pl http://www.youtube.com/watch?v=D0p5RKzuJLU: No such file or directory
./auto.sh: line 7: ./yt.pl http://www.youtube.com/watch?v=sY6-PY9wWQ8: No such file or directory
./auto.sh: line 7: ./yt.pl http://www.youtube.com/watch?v=TRwcozVntTE: No such file or directory
./auto.sh: line 7: ./yt.pl http://www.youtube.com/watch?v=ft5hp90FV74&feature=relmfu: No such file or directory
./auto.sh: line 7: ./yt.pl http://www.youtube.com/watch?v=DB1E4M7bmeM: No such file or directory
./auto.sh: line 7: ./yt.pl http://www.youtube.com/watch?v=t6w4yeT6OTg&feature=relmfu: No such file or directory
./auto.sh: line 7: ./yt.pl http://www.youtube.com/watch?v=t-m88UZXn_8&feature=related: No such file or directory
./auto.sh: line 7: ./yt.pl http://www.youtube.com/watch?v=iix8NxDN6mQ&feature=relmfu: No such file or directory
./auto.sh: line 7: ./yt.pl http://www.youtube.com/watch?v=O3DvUKEZP_0&feature=relmfu: No such file or directory
./auto.sh: line 7: ./yt.pl http://www.youtube.com/watch?v=IKVdSNfbilo: No such file or directory
./auto.sh: line 7: ./yt.pl http://www.youtube.com/watch?v=V3kjn1zM7OI&feature=relmfu: No such file or directory
./auto.sh: line 7: ./yt.pl http://www.youtube.com/watch?v=EhJheZepqqY&feature=relmfu: No such file or directory
./auto.sh: line 7: ./yt.pl http://www.youtube.com/watch?v=59Oj_xpxh_g&feature=relmfu: No such file or directory
./auto.sh: line 7: ./yt.pl http://www.youtube.com/watch?v=DLP8XMMEG0A: No such file or directory
./auto.sh: line 7: ./yt.pl http://www.youtube.com/watch?v=pCY5ZRXQ3u0&feature=relmfu: No such file or directory
./auto.sh: line 7: ./yt.pl http://www.youtube.com/watch?v=a8CHv8n6qpI&feature=relmfu: No such file or directory
./auto.sh: line 7: ./yt.pl http://www.youtube.com/watch?v=afJXLpC95lQ&feature=relmfu: No such file or directory
./auto.sh: line 7: ./yt.pl http://www.youtube.com/watch?v=6q4dPeUjmu8&feature=relmfu: No such file or directory
./auto.sh: line 7: ./yt.pl http://www.youtube.com/watch?v=0BY5V56ZW3w&feature=relmfu: No such file or directory
./auto.sh: line 7: ./yt.pl http://www.youtube.com/watch?v=9CO__3nHsg8: No such file or directory
./auto.sh: line 7: ./yt.pl http://www.youtube.com/watch?v=bzgZlV3LzFA&feature=fvst: No such file or directory
./auto.sh: line 7: ./yt.pl http://www.youtube.com/watch?v=FgS1UQvYtcU&feature=fvst: No such file or directory
尝试这样做:
#!/bin/bash
while read link; do
./yt.pl "$link" && sleep 3
done < download.txt