#!/usr/bin/bash source "$HOME"/.config/Hentai.conf IGREEN="\033[0;92m" # Intense Green IYELLOW="\033[0;93m" # Intense Yellow IRED='\033[0;91m' # Intense Red NO_COLOR="\033[0m" # Text Reset [[ -z $1 ]] && exit 1 if [[ -z $2 ]]; then output=$(Hentai add_url "$1") else output=$(Hentai add_custom_name "$1" "$2") fi echo "$output" [[ $output =~ "#" ]] || exit 1 url=$(awk '{print $1}' <<< "$output") path=$(awk '{print $3}' <<< "$output") for ((n=0;n<5;n++)); do if [[ $url =~ "iwara.tv" ]]; then echo "command: yt-dlp --config-locations ./yt-dlp/iwara.conf -o ${path}/%(id)s.%(ext)s $url" if yt-dlp --config-locations ./yt-dlp/iwara.conf -o "${path}/%(id)s.%(ext)s" "$url"; then echo -e "${IGREEN}Success${NO_COLOR}" exit 0 fi else echo "command: gallery-dl --config ./gallery-dl/config.json --directory $path $url" if gallery-dl --config ./gallery-dl/config.json --directory "$path" "$url"; then echo -e "${IGREEN}Success${NO_COLOR}" exit 0 fi fi echo -e "${IYELLOW}download failed${NO_COLOR}" if has_internet; then echo -e "${IGREEN}has internet${NO_COLOR}" else echo -e "${IYELLOW}no internet${NO_COLOR}" exit 1 fi done