Last active
December 1, 2023 11:46
-
-
Save andersonbosa/03ebaa9a98fa06d81ce66ee57e8cedb6 to your computer and use it in GitHub Desktop.
Set a timer to download videos from YouTube using `yt-dlp`. Used in Ubuntu Mantic.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Author: | |
# https://github.com/andersonbosa | |
# | |
# Description | |
# Set a timer to download videos from YouTube using `yt-dlp`. | |
# | |
# Tested: | |
# Used in Ubuntu Mantic. | |
# | |
# Use example: | |
# ./youtube_downloader.sh 10m https://www.youtube.com/watch?v=8y3Q_PnhQYo | |
# | |
# Requeriments: | |
# yt-dlp - https://github.com/yt-dlp/yt-dlp | |
# | |
set -e | |
if [ ! "$(command -v yt-dlp)" ]; then | |
echo 'Missing dependency! Install "yt-dlp" to use.' | |
echo 'Check: "https://github.com/yt-dlp/yt-dlp"' | |
fi | |
SLEEP_TIME="$1" | |
VIDEO_LINK="$2" | |
notify-send "$0" "Wating $SLEEP_TIME before download... $VIDEO_LINK" | |
sleep "$SLEEP_TIME" | |
cd ~/Videos | |
notify-send "$0" "Initing download..." && | |
yt-dlp -f mp4 $VIDEO_LINK && | |
open . | |
notify-send "$0" "Video '$(ls -t | head -n1)' downloaded! \nSee ~/Videos" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment