mirror of
https://github.com/AChep/keyguard-app.git
synced 2024-12-11 07:56:17 +01:00
36 lines
923 B
Python
36 lines
923 B
Python
|
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)
|
||
|
|
||
|
with open('common/src/commonMain/resources/MR/files/justgetmydata.json', 'w') as f:
|
||
|
f.write(aggr_text)
|