shell/install/youtube-dl

41 lines
1.2 KiB
Plaintext
Raw Normal View History

2022-10-05 03:30:31 +00:00
#!/bin/bash
2023-04-11 15:45:41 +00:00
##makedesc: Install youtube-dl (src)
2022-10-05 03:30:31 +00:00
# https://github.com/ytdl-org/youtube-dl#installation
echo
echo "==============================================="
2023-04-11 15:45:41 +00:00
echo "Installing youtube-dl (src)..."
2022-10-05 03:30:31 +00:00
echo "==============================================="
echo
2023-04-11 15:45:41 +00:00
# 11.04.23: release 2021.12.17 in snap/apt/github is broken (Unable to extract uploader id)
# and still no fix officially released, so we just build it from actual sources
# curl -L https://yt-dl.org/downloads/latest/youtube-dl -o "${HOME}/.local/bin/youtube-dl" && \
# sudo chmod +rx "${HOME}/.local/bin/youtube-dl"
installed() {
command -v "$1" >/dev/null 2>&1
}
! installed make && sudo apt install -y make
mkdir -p "$HOME/install/youtube-dl" "$HOME/.local/bin"
if installed git; then
git clone https://github.com/ytdl-org/youtube-dl.git "$HOME/install/youtube-dl" --depth=1 --single-branch
else
! installed wget && sudo apt install -y wget
wget https://github.com/ytdl-org/youtube-dl/archive/refs/heads/master.zip -O "$HOME/install/youtube-dl.zip" && \
unzip -oq "$HOME/install/youtube-dl.zip" -d "$HOME/install/youtube-dl"
fi
cd "$HOME/install/youtube-dl" && \
make youtube-dl && \
mv youtube-dl "$HOME/.local/bin"
echo
echo "Finish!"
youtube-dl --version
echo