diff --git a/.gitea/workflows/scrape.yml b/.gitea/workflows/scrape.yml index 2e20ea1..ae67762 100644 --- a/.gitea/workflows/scrape.yml +++ b/.gitea/workflows/scrape.yml @@ -3,7 +3,7 @@ name: Scrape latest data on: push: schedule: - - cron: '*/30 * * * *' + - cron: '0 * * * *' workflow_dispatch: jobs: diff --git a/scrape.sh b/scrape.sh index 1e7f7c9..2f51dda 100755 --- a/scrape.sh +++ b/scrape.sh @@ -7,16 +7,12 @@ rm -r out 2>/dev/null || true; mkdir -p out CLOUDFLARE_API="https://api.cloudflare.com/client/v4" HEADERS=( -H "Authorization: Bearer ${CLOUDFLARE_API_TOKEN}" - -H "Content-Type: application/json" ) curl -s "${CLOUDFLARE_API}/zones" "${HEADERS[@]}" | \ - jq -r '.result[] | .id' | while read zone_id; do - - zone_name=$(curl -s "${CLOUDFLARE_API}/zones/${zone_id}" "${HEADERS[@]}" | \ - jq -r '.result.name') + jq -r '.result[] | "\(.id) \(.name)"' | while read zone_id zone_name; do echo "Fetching DNS records for: ${zone_name}" curl -s "${CLOUDFLARE_API}/zones/${zone_id}/dns_records/export" "${HEADERS[@]}" \ - > "out/${zone_name}.txt" && sed -i '/^;; Exported:/d' "out/${zone_name}.txt" + > "out/${zone_name}.txt" done