Skip to content

Commit a3277a7

Browse files
feat: update downloading function
Change-Id: Ied5039453512405b554c5be90b7cacc0116e3502
1 parent df44f69 commit a3277a7

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

dumpyara.sh

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,24 @@ if echo "$1" | grep -e '^\(https\?\|ftp\)://.*$' > /dev/null; then
8888

8989
# Download to the 'input/' directory
9090
cd "$PROJECT_DIR"/input || exit
91-
echo "${URL}"
92-
{ type -p aria2c > /dev/null 2>&1 && printf "Downloading File...\n" && aria2c -x16 -j"$(nproc)" "${URL}"; } || { printf "Downloading File...\n" && wget -q --content-disposition --show-progress --progress=bar:force "${URL}" || exit 1; }
91+
92+
# Download with 'aria2c' and, if failed, via 'wget'
93+
LOGI "Downloading file through 'aria2c'... ($(date +%R:%S))"
94+
aria2c -x16 -j"$(nproc)" "${URL}" || {
95+
LOGI "'aria2c' failed. Using 'wget' to download file... ($(date +%R:%S))"
96+
wget -q --no-check-certificate "${URL}" || \
97+
LOGF "Failed to download from link.";
98+
}
99+
100+
# Check for 'Content-Disposition'
93101
if [[ ! -f "$(echo "${URL##*/}" | inline-detox)" ]]; then
94102
URL=$(wget --server-response --spider "${URL}" 2>&1 | awk -F"filename=" '{print $2}')
95103
fi
96104
detox "${URL##*/}"
97105
else
98106
URL=$(printf "%s\n" "$1")
99-
[[ -e "$URL" ]] || { echo "Invalid Input" && exit 1; }
107+
[[ -e "$URL" ]] || \
108+
LOGF "Invalid Input"
100109
fi
101110

102111
ORG=AndroidDumps #your GitHub org name

0 commit comments

Comments
 (0)