only accept 200

This commit is contained in:
squidbear
2025-03-23 12:08:14 +01:00
parent df80758e55
commit 38f0db07b5

View File

@@ -40,17 +40,13 @@ done
output="" output=""
for url in "${urls[@]}"; do for url in "${urls[@]}"; do
#echo "curl -s ${options[@]} $url" #echo "curl -s ${options[@]} $url"
output=$(eval "curl -s ${options[@]@Q} '$url'") output=$(eval "curl -s ${options[@]@Q} '$url' --fail-with-body")
if [[ $? -eq 0 ]]; then if [[ $? -eq 0 ]]; then
if cat "$temp_file" | jq -e 'has("error")' > /dev/null 2>&1; then if cat "$temp_file" | jq -e 'has("error")' > /dev/null 2>&1; then
continue # Try the next URL continue # Try the next URL
fi fi
if [[ $output -ne 200 ]]; then
continue
fi
if [ -n "$original_output" ]; then if [ -n "$original_output" ]; then
#echo "$(cat $temp_file)" #echo "$(cat $temp_file)"
cat "$temp_file" > "$original_output" cat "$temp_file" > "$original_output"