#!/usr/bin/env bash
# Verifikasi gelombang 6 Yasma setelah purge
set -u
UA="Mozilla/5.0"
cek() {
  local label="$1"; local u="$2"
  curl -s -4 -D /tmp/yh6.txt --max-time 60 -A "$UA" "https://yasmanatura.co.id$u" -o /tmp/yb6.html
  local kode cf faq h3 titel desk
  kode=$(head -1 /tmp/yh6.txt | tr -d '\r' | awk '{print $2}')
  cf=$(grep -i '^cf-cache-status' /tmp/yh6.txt | tr -d '\r' | awk '{print $2}')
  faq=$(grep -c '"FAQPage"' /tmp/yb6.html || true)
  h3=$(grep -o -c '<h3>' /tmp/yb6.html || true)
  titel=$(grep -o -E "<title>[^<]*" /tmp/yb6.html | sed 's/<title>//' | head -1)
  desk=$(grep -o -E '<meta name="description" content="[^"]*"' /tmp/yb6.html | sed 's/.*content="//; s/"$//' | head -1)
  printf "  [%s] %-4s cf=%-5s FAQPage=%s pertanyaan=%s\n      judul: %s\n      meta (%s char): %s\n" \
    "$label" "$kode" "${cf:--}" "$faq" "$h3" "${titel:0:88}" "${#desk}" "${desk:0:100}"
}
echo "=== PILAR GELOMBANG 6 ==="
cek "pilar" "/7-alasan-yasma-natura-jadi-pilihan-utama-jasa-produksi-minuman-serbuk-terbaik/"
echo "=== yang dipensiunkan (harus 404) ==="
cek "trash" "/alasan-mengapa-yasma-natura-menjadi-pilihan-terbaik/"
cek "trash" "/5-alasan-umkm-wajib-pakai-jasa-maklon-minuman-serbuk/"
