0

インターネット(https://calomel.org/youtube_wget.html)で、YouTubeの動画を取得するスクリプトを見つけました。

したがって、スクリプトは、入力するだけで1つのクリップに対して完全に機能します./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
4

1 に答える 1

2

これを試してみてください:

#!/bin/bash

while read link; do
    ./yt.pl "$link" && sleep 3
done < download.txt
于 2012-11-02T01:35:54.643 に答える