CLI で YouTube 動画のタイトルを取得する

コマンドラインで YouTube 動画のタイトルを取得する方法。

環境:macOS Catalina Version 10.15.6(英語環境)

(方法1)Mac にデフォルトで入っているコマンドを使う。

$ wget -qO- '[動画 URL ]' | perl -l -0777 -ne 'print $1 if /<title.*?>\s*(.*?)\s*<\/title/si'

(方法2)youtube-dl を使う。

$ youtube-dl --skip-download "[動画 URL ]" --get-title

curl コマンドが使えるなら FileMaker から直接取得できるはずだが、その方法はまだ研究中。

参考:
web - How do I get a websites title using command line? - Unix & Linux Stack Exchange
https://unix.stackexchange.com/questions/103252/how-do-i-get-a-websites-title-using-command-line

awk - Download and sort list of all videos from a youtube channel with youtube-dl - Unix & Linux Stack Exchange
https://unix.stackexchange.com/questions/684116/download-and-sort-list-of-all-videos-from-a-youtube-channel-with-youtube-dl


この記事が気に入ったらサポートをしてみませんか?