From 9ce5b1ca57b0911a808a4832843eb2ed84e586d2 Mon Sep 17 00:00:00 2001 From: Kibi Kelburton Date: Sat, 13 Jun 2026 16:14:37 +0200 Subject: [PATCH] get the direct url --- uploader.sh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/uploader.sh b/uploader.sh index a781938..244139e 100755 --- a/uploader.sh +++ b/uploader.sh @@ -57,12 +57,11 @@ HTTP_CODE=$(echo "$RESPONSE" | tail -n1) BODY=$(echo "$RESPONSE" | sed '$d') if [ "$HTTP_CODE" -ge 200 ] && [ "$HTTP_CODE" -lt 300 ]; then - # Parse the URL from the JSON response. - # This assumes a response like {"url": "https://..."} - # You might need to adjust the regex or use jq depending on your API structure. - URL=$(echo "$BODY" | grep -oP '"url"\s*:\s*"\K[^"]+') + # Parse the direct file URL from the JSON response. + # Expects a response containing a "file_url" field. + URL=$(echo "$BODY" | grep -oP '"file_url"\s*:\s*"\K[^"]+') - # Fallback: if no URL field is found, just copy the whole body if it's a raw string + # Fallback: if no file_url field is found, just copy the whole body if it's a raw string if [ -z "$URL" ]; then URL="$BODY" fi