From ea3b6705468a7a4cc3f3f70e901be861a6c3961a Mon Sep 17 00:00:00 2001 From: AustrianToast Date: Fri, 7 Feb 2025 21:57:12 +0100 Subject: [PATCH] add iwara support --- add_and_download_url.sh | 37 +++++++++++++++++++++---------------- download_website.sh | 23 ++++++++++++++--------- yt-dlp/downloaded.txt | 2 ++ yt-dlp/iwara.conf | 7 +++++++ yt-dlp/yt-dlp_iwara.conf | 12 ------------ 5 files changed, 44 insertions(+), 37 deletions(-) create mode 100644 yt-dlp/downloaded.txt create mode 100644 yt-dlp/iwara.conf delete mode 100644 yt-dlp/yt-dlp_iwara.conf diff --git a/add_and_download_url.sh b/add_and_download_url.sh index b5c2f05..084a8e4 100755 --- a/add_and_download_url.sh +++ b/add_and_download_url.sh @@ -19,28 +19,33 @@ echo "$output" url=$(echo "$output" | awk '{print $1}') path=$(echo "$output" | awk '{print $3}') -if [[ $(hostname) = \s\a\t\a\n ]]; then - [[ -d ./Artists ]] || mkdir ./Artists - rm -rf ./gallery-dl/*.sqlite3 ./gallery-dl/log.txt ./Artists/* || exit 1 -fi - -echo "command: gallery-dl --config ./gallery-dl/config.json --directory $path $url" +[[ $(hostname) = \s\a\t\a\n ]] && rm -rf ./Artists/* for ((n=0;n<5;n++)); do - if ! gallery-dl --config ./gallery-dl/config.json --directory "$2" "$1"; then - echo -e "${IGREEN}Success${NO_COLOR}" - exit 0 + 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 ! ping -c 3 v4.ip.hopeless-cloud.xyz > /dev/null 2>&1; then - echo -e "${IRED}no internet${NO_COLOR}" + if ! ping -qc 3 v4.ip.hopeless-cloud.xyz > /dev/null 2>&1; then + echo -e "${IYELLOW}no internet${NO_COLOR}" exit 1 - fi - if ! ping -c 3 v6.ip.hopeless-cloud.xyz > /dev/null 2>&1; then - echo -e "${IRED}no internet${NO_COLOR}" + elif ! ping -qc 3 v6.ip.hopeless-cloud.xyz > /dev/null 2>&1; then + echo -e "${IYELLOW}no internet${NO_COLOR}" exit 1 + else + echo -e "${IGREEN}has internet${NO_COLOR}" fi - - echo -e "${IGREEN}has internet${NO_COLOR}" done diff --git a/download_website.sh b/download_website.sh index 1d45bc0..22ecd59 100755 --- a/download_website.sh +++ b/download_website.sh @@ -12,10 +12,18 @@ download() { SUCCESS="false" for ((n=0;n<5;n++)); do - if gallery-dl --config ./gallery-dl/config.json --directory "$2" "$1"; then - echo "$1" >> "$SUCCESS_FILE" - SUCCESS="true" - break + if [[ $1 =~ "iwara.tv" ]]; then + if yt-dlp --config-locations ./yt-dlp/iwara.conf -o "${2}/%(id)s.%(ext)s" "$1"; then + echo "$1" >> "$SUCCESS_FILE" + SUCCESS="true" + break + fi + else + if gallery-dl --config ./gallery-dl/config.json --directory "$2" "$1"; then + echo "$1" >> "$SUCCESS_FILE" + SUCCESS="true" + break + fi fi echo -e "${IYELLOW}download failed${NO_COLOR}" @@ -33,10 +41,7 @@ download() { [[ $SUCCESS != \t\r\u\e ]] && echo "$1" >> "$FAIL_FILE" } -if [[ $(hostname) = \s\a\t\a\n ]]; then - [[ -d ./Artists ]] || mkdir ./Artists - rm -rf ./gallery-dl/*.sqlite3 ./gallery-dl/log.txt ./Artists/* || exit 1 -fi +[[ $(hostname) = \s\a\t\a\n ]] && rm -rf ./Artists/* if [[ -f $FAIL_FILE ]]; then [[ -f "${FAIL_FILE}.old" ]] && rm -f "${FAIL_FILE}.old" @@ -66,4 +71,4 @@ while IFS= read -r line; do download $url $path done < "$IN_FILE" -[[ $(hostname) != \s\a\t\a\n ]] && cp ./gallery-dl/archive-${1,,}.sqlite3 /data/backup +[[ -s $FAIL_FILE ]] && echo -e "${IGREEN}Sucess!${NO_COLOR}" || echo -e "${IRED}Some links failed!${NO_COLOR}" diff --git a/yt-dlp/downloaded.txt b/yt-dlp/downloaded.txt new file mode 100644 index 0000000..cb91099 --- /dev/null +++ b/yt-dlp/downloaded.txt @@ -0,0 +1,2 @@ +iwara uujEyv4Z53qada +iwara xFJmQbF75V2Rhg diff --git a/yt-dlp/iwara.conf b/yt-dlp/iwara.conf new file mode 100644 index 0000000..6b16345 --- /dev/null +++ b/yt-dlp/iwara.conf @@ -0,0 +1,7 @@ +# Video settings +-f "Source / 540 / 360" + +# Download settings +--limit-rate 10M +--retries 10 +--abort-on-unavailable-fragments diff --git a/yt-dlp/yt-dlp_iwara.conf b/yt-dlp/yt-dlp_iwara.conf deleted file mode 100644 index f4d2e26..0000000 --- a/yt-dlp/yt-dlp_iwara.conf +++ /dev/null @@ -1,12 +0,0 @@ -# Video settings --f "Source / 540 / 360" - -# Download settings ---limit-rate 10M ---retries 10 ---abort-on-unavailable-fragments - -# Filesystem settings ---restrict-filenames --P "/home/rene/projects/Hentai/yt-dlp/Artists" -# -o "%(uploader_id)s/%(id)s.%(ext)s"