2023-12-29 17:38:23 +01:00
|
|
|
import json
|
|
|
|
import requests
|
|
|
|
|
|
|
|
URL_JGMD = "https://raw.githubusercontent.com/daviddavo/jgmd/master/_data/sites.json"
|
|
|
|
|
|
|
|
response = requests.get(
|
|
|
|
URL_JGMD,
|
|
|
|
)
|
|
|
|
|
|
|
|
aggr = []
|
|
|
|
|
|
|
|
for site in response.json():
|
|
|
|
entry = {
|
|
|
|
'name': site['name'],
|
|
|
|
'domains': site.get('domains', []),
|
|
|
|
}
|
|
|
|
|
|
|
|
def append_if_not_empty(src_key, dst_key):
|
|
|
|
if src_key in site and site[src_key]:
|
|
|
|
entry[dst_key] = site[src_key]
|
|
|
|
|
|
|
|
append_if_not_empty('url', 'url')
|
|
|
|
append_if_not_empty('difficulty', 'difficulty')
|
|
|
|
append_if_not_empty('notes', 'notes')
|
|
|
|
# for the extra-asshole websites
|
|
|
|
append_if_not_empty('email', 'email')
|
|
|
|
append_if_not_empty('email_subject', 'email_subject')
|
|
|
|
append_if_not_empty('email_body', 'email_body')
|
|
|
|
|
|
|
|
aggr.append(entry)
|
|
|
|
|
|
|
|
aggr_text = json.dumps(aggr, indent=2)
|
|
|
|
|
2024-05-25 12:04:50 +02:00
|
|
|
with open('common/src/commonMain/composeResources/files/justgetmydata.json', 'w') as f:
|
2023-12-29 17:38:23 +01:00
|
|
|
f.write(aggr_text)
|