Homebrewでyoutube-dlをインスコ。
Terminal
brew install youtube-dl
オートメーターでコマンド実行のサービスを作成。
URLを引数として受け取るようにし、
Automator
VID=`echo $1 | sed 's/^.*v=//g'`;
FMT=`youtube-dl -F ${VID} | grep mp4 | sort -r | head -1 | cut -b 1-2`;
cd ~/Downloads;
youtube-dl -o '%(title)s.%(ext)s' -f ${FMT} ${VID};
これを実行すると自動的にmp4で可能なサイズの中で最も大きいものをフォーマットとして選び、ダウンロードしてくれる。
好みに合わせてmp4の部分を他のフォーマットにしたり、ソートの-rを取れば最も小さなサイズを選択したり、cdのところで保存フォルダを変えられます。
ちなみにnicovideo-dlなるものもありました。
コマンドの内容は名前から察する通りですが、使える機能がyoutube-dlほど多くないのと、nicovideo-dlのほうは-uでユーザーネーム、-pでパスワードを指定しないと一部の動画しかアクセス出来ないかもしれません。
youtube-dlでも-u,-pでログイン出来ますが、ログインしなくてもダウンロード出来るので必要性が感じられません。
むしろログインに時間を取られてしまうだけです。
Automator
VID=`echo $1 | sed 's/\(^.*\/watch\/\)//g' | sed 's/?.*$//g'`;
cd ~/Downloads;
nicovideo-dl -u ユーザーネーム -p パスワード -t ${VID};
これでいけます。
実行はURL上で右クリックでコンテキストメニュー開いてサービスから選ぶ。