This commit is contained in:
@@ -3,7 +3,7 @@ name: Scrape latest data
|
||||
on:
|
||||
push:
|
||||
schedule:
|
||||
- cron: '*/30 * * * *'
|
||||
- cron: '0 * * * *'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user