Skip to content

Commit 2ad2289

Browse files
authored
fix: Follow download redirects (#241)
1 parent 7914ef8 commit 2ad2289

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/mido.sh

+15
Original file line numberDiff line numberDiff line change
@@ -635,6 +635,21 @@ getMG() {
635635
return 1
636636
fi
637637

638+
local domain="buzzheavier.com"
639+
640+
if [[ "$result" = *"$domain"* ]]; then
641+
result=$(curl --silent --max-time 30 --request GET --user-agent "$user_agent" --referer "$result" --head --proto =https --tlsv1.2 --http1.1 -- "$result/download") || {
642+
handle_curl_error "$?" "$domain"
643+
return $?
644+
}
645+
result=$(echo "$result" | grep -i -m 1 "hx-redirect:")
646+
if [ -z "$result" ]; then
647+
error "Failed to extract redirect location! Please report this at $SUPPORT/issues."
648+
return 1
649+
fi
650+
result="https://${domain}${result:13}"
651+
fi
652+
638653
MG_URL="$result"
639654
return 0
640655
}

0 commit comments

Comments
 (0)