- booking_log.txt: midnight run results (cita booked at 15:15, 3347ms RTT) - fire_at_midnight.py: original midnight launch script - book_cita.sh / book_at_midnight.py: booking shell scripts - fetch_final.py / fetch_cita.sh: API fetch utilities - services_full.js, controllers_full.js, app_real2.js: frontend source - services_real.js, url.js: API endpoint references - tipos_doc.json: document type data from API - benchmark_results.json: server load profiling results
26 lines
810 B
Bash
Executable File
26 lines
810 B
Bash
Executable File
#!/bin/bash
|
|
URL="https://citaprevia.alicante.es/citaprevia/pedir-cita"
|
|
UA="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
|
|
MAX=25
|
|
for i in $(seq 1 $MAX); do
|
|
echo "=== Attempt $i of $MAX ==="
|
|
curl -sSL -A "$UA" "$URL" -o /tmp/cita_previa.html \
|
|
-w "HTTP:%{http_code} SIZE:%{size_download} TIME:%{time_total}\n" \
|
|
--max-time 45 --connect-timeout 15
|
|
CODE=$?
|
|
if [ $CODE -eq 0 ]; then
|
|
SIZE=$(wc -c < /tmp/cita_previa.html)
|
|
if [ "$SIZE" -gt 5000 ]; then
|
|
echo "SUCCESS: got $SIZE bytes"
|
|
break
|
|
else
|
|
echo "Got $SIZE bytes (too small), retrying..."
|
|
fi
|
|
elif [ $CODE -eq 28 ]; then
|
|
echo "timeout, retrying..."
|
|
else
|
|
echo "curl error $CODE, retrying..."
|
|
fi
|
|
sleep $((i > 5 ? 5 : 3))
|
|
done
|