feat: Initialize SvelteKit project, add tsconfig.json, and introduce a new Calculator.svelte component.

This commit is contained in:
Ben
2026-03-06 21:18:58 -08:00
parent e35fdcb118
commit 47042ee5a7
30 changed files with 3887 additions and 0 deletions

21
test_wp_fetch.py Normal file
View File

@@ -0,0 +1,21 @@
import json
import urllib.request
import re
URL = 'https://howdoyouconvert.com/wp-json/wp/v2/calculator?per_page=5'
req = urllib.request.Request(URL, headers={'User-Agent': 'Mozilla/5.0'})
try:
with urllib.request.urlopen(req) as response:
data = json.loads(response.read().decode())
for post in data:
slug = post['slug']
content = post['content']['rendered']
# try to extract just paragraph text
pars = re.findall(r'<p>(.*?)</p>', content, re.DOTALL)
text = " ".join(pars)
# strip a tags and strong tags
text = re.sub(r'<[^>]+>', '', text)
print(f"Slug: {slug}")
print(f"Content: {text[:200]}...\n")
except Exception as e:
print(e)