feat: Add new calculator batches (6-10) and associated deployment/verification scripts, and update the calculator list.

This commit is contained in:
Ben
2026-02-21 01:29:19 -08:00
parent 569b11d2ea
commit d381cd6610
16 changed files with 1901 additions and 13 deletions

60
audit_mapping.py Normal file
View File

@@ -0,0 +1,60 @@
import urllib.request
import json
import base64
import time
import re
url_base_kadence = "https://howdoyouconvert.com/wp-json/wp/v2/kadence_element"
url_base_calc = "https://howdoyouconvert.com/wp-json/wp/v2/calculator"
creds = base64.b64encode(b"ben:6YGf wVxu gBpz pkqx BGZO lfVP").decode("utf-8")
headers = {
"Authorization": "Basic " + creds,
"User-Agent": "Mozilla/5.0"
}
def get_all(url):
results = []
page = 1
while True:
req = urllib.request.Request(f"{url}?per_page=100&page={page}", headers=headers)
try:
resp = urllib.request.urlopen(req, timeout=30)
data = json.loads(resp.read().decode("utf-8"))
if not data: break
results.extend(data)
page += 1
except:
break
return results
print("Fetching all calculators...")
calcs = get_all(url_base_calc)
calc_map = {c['id']: c['slug'] for c in calcs}
print("Fetching all elements...")
elements = get_all(url_base_kadence)
mapping = []
for e in elements:
meta = e.get('meta', {})
cond = meta.get('_kad_element_show_conditionals', '')
if cond:
try:
cond_data = json.loads(cond)
if isinstance(cond_data, list) and len(cond_data) > 0:
ids = cond_data[0].get('ids', [])
for pid in ids:
if pid in calc_map:
mapping.append({
'eid': e['id'],
'pid': pid,
'slug': calc_map[pid],
'title': e['title']['rendered']
})
except:
continue
with open("/tmp/element_mapping.json", "w") as f:
json.dump(mapping, f, indent=2)
print(f"Found {len(mapping)} mappings.")