Files
dotfiles/scripts/shell/gdl.sh
2024-06-19 07:57:11 -03:00

22 lines
410 B
Bash
Executable File

#!/usr/bin/zsh
if ! command -v "gallery-dl" &> /dev/null; then
echo 'The "gallery-dl" command is necessary in order to run the script, but was not found.'
exit 1
fi
media_url=$1
gallery-dl $media_url
if [[ $? -ne 0 ]]; then
printf "\n"
echo "[ERROR] `basename $0`: Could not download url \"$media_url\""
exit 1
fi
find gallery-dl -type f -exec mv '{}' . \;
rm --recursive gallery-dl