用 ubuntu 16.04 安裝 Youtube-dl 下載影片

-Youtube-dl 相信有很多人使用,也有很多人寫使用方法,所以,我會用相關連結提供,如下:

安裝連結:https://blog.gtwang.org/useful-tools/youtube-dl/

我是透過 ubuntu 16.04 server 來進行下載影片,最主要的是 youtube and facebook。

最主要下載的 youtube-dl 語法如下:

下載 faceboo 影片
youtube-dl -F https://www.facebook.com/s3beauty/videos/298125474438944/
下載 youtube 影片 youtube-dl https://www.youtube.com/watch?v=nRpuJjWyXnk

後來我參考別人的 script ,然後改成連 facebook 也可以下載。

參考如下:

#!/bin/bash
answer=""
tput clear
tput cup 05 10
echo "Give the YouTube URL: "
# Here you paste the YT-video-URL by ctrl+shift+V
read answer
# The follwing command will display a list of video quality options to choose from
youtube-dl -F $answer
echo
# Here you give the number shown in first column as per your choice
echo "Select Quality (Choose a number): "
read qual
# If you don't want to download and quit the shell, give 99
if [ $qual != "$1" ]
then
sudo -u www-data /usr/local/bin/youtube-dl -f $qual -o "/mnt/blockstorage/data/michael/files/film/%(title)s.%(ext)s" $answer
else
exit 0
fi

-o 那個路徑請改成當前環境的路徑,不要 copy 都不改的…

只要看到那個影片需要下載的話,我都會透過 youtube-dl 進行下載