Skip to content

Commit

Permalink
fix: Follow download redirects (#981)
Browse files Browse the repository at this point in the history
  • Loading branch information
kroese authored Dec 20, 2024
1 parent 6825b6a commit 57193b0
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/mido.sh
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,21 @@ getMG() {
return 1
fi

local domain="buzzheavier.com"

if [[ "$result" = *"$domain"* ]]; then
result=$(curl --silent --max-time 30 --request GET --user-agent "$user_agent" --referer "$result" --head --proto =https --tlsv1.2 --http1.1 -- "$result/download") || {
handle_curl_error "$?" "$domain"
return $?
}
result=$(echo "$result" | grep -i -m 1 "hx-redirect:")
if [ -z "$result" ]; then
error "Failed to extract redirect location! Please report this at $SUPPORT/issues."
return 1
fi
result="https://${domain}${result:13}"
fi

MG_URL="$result"
return 0
}
Expand Down

0 comments on commit 57193b0

Please sign in to comment.