Mac
Linux
Terminal
YouTube
mplayer

コマンドラインからyoutubeを再生する

More than 3 years have passed since last update.


使うもの


  • youtube-dl

  • mplayer (or mpv)


install


https://github.com/rg3/youtube-dl/blob/master/README.md#installation



Mac


Homebrew

$ brew install youtube-dl mplayer



Linux


apt*/yum

$ sudo apt-get install youtube-dl mplayer



Windows


youtube-dl.exe

https://yt-dl.org/latest/youtube-dl.exe



https://github.com/rg3/youtube-dl/releases



mplayer-win

http://oss.netfarm.it/mplayer-win32.php



update


native

$ sudo youtube-dl -U # -U/--update

# or
youtube-dl -U


python-pip


install

$ sudo apt-get install python-pip # if needed

$ sudo pip install youtube-dl


update

$ sudo pip install -U youtube-dl # -U/--update



コマンド

通常再生

$ youtube-dl 'https://www.youtube.com/watch?v=hoge' -o - | mplayer -

音声のみ

$ youtube-dl 'https://www.youtube.com/watch?v=hoge' -o - | mplayer - -novideo

or


fetch-sound-only

$ youtube-dl 'https://www.youtube.com/watch?v=hoge' -f bestaudio -o - | mplayer -




mpv

next mplayer2


install


play


play

$ mpv 'https://www.youtube.com/watch?v=hoge'



sound-only

$ mpv 'https://www.youtube.com/watch?v=hoge' --no-video # or -no-video



http://mpv.io/manual/master/