0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

VJ素材をダウンロードするとき便利なyt-dlpのシェルスクリプト作った

Last updated at Posted at 2025-03-30

VJ素材をダウンロードするにはyt-dlpを使うけど、いちいちコマンドやらオプションやらを入力するのは面倒いので、それを解決するスクリプトを作った。

前提条件

yt-dlpとかffmpegが導入されている

もしまだ導入してないなら、下の「参考」にやり方のリンク貼っといたから見てね

シンプルにダウンロード

スクリプトはこちら、yt-dlpのオプションは各々で適宜変更してね。

simpledl.sh
#!/bin/zsh

cd ~/Desktop
echo "動画をダウンロード"
read "url_v"
yt-dlp -f "bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]" -o "%(title)s.%(ext)s" "$url_v"

繰り返しダウンロード

次のスクリプトは、ダウンロードが終わっても終了せずに、またURL入力待機状態に戻るスクリプト。
一回起動したら、いちいちスクリプトを呼び出さんでよくなる。

loopdl.sh
#!/bin/zsh

cd ~/Desktop

while true
do
  echo "動画をダウンロード"
  read "url_v"
  yt-dlp -f "bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]" -o "%(title)s.%(ext)s" "$url_v"
done

スクリプトから抜ける時は^Cしてね。

使い方

  1. テキストエディットにスクリプトをコピペして保存
    スクリーンショット05.png

  2. ターミナルでsh simpledl.sh(またはloopdl.sh)と入力してエンターキー押す
    スクリーンショット46.png

  3. 動画をダウンロードと表示されたら、ダウンロードしたいURLを入力してエンターキー押す
    スクリーンショット44.png

以上

ToDo

loopdl.shで^Cしなくても抜けられるようにしたい

参考

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?