from lxml import html
import requests
import json
data = []
tplist = requests.get("https://translationproject.org/domain/index.html")
if(tplist.status_code == 200):
tree = html.fromstring(tplist.content)
domains = tree.xpath('//table/tr/td[1]/a/text()')
for d in domains:
data.append({"name": d, "system": 0})
transifexlist = {
'openstreetmap': ['id-editor', 'osmybiz', 'openinghoursfragment',
'presets', 'vespucci'],
}
for k in transifexlist:
for proj in transifexlist[k]:
data.append({'name': proj, 'system': 1, 'organisation': k})
with open('offlate/data.json', 'w') as f:
f.write(json.dumps(data))