Skip to content

Instantly share code, notes, and snippets.

@quozl
Created September 25, 2017 05:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save quozl/3f272f261b29ef6569e8b7b7f320bee7 to your computer and use it in GitHub Desktop.
Save quozl/3f272f261b29ef6569e8b7b7f320bee7 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
# generate list of translation contributors for sugar and sugar-toolkit-gtk3
# by james cameron, 25th september 2017
from lxml import html
import requests
import os
cache = '/tmp/translate-sugarlabs-org-sucrose-contributors.html'
if not os.access(cache, os.R_OK):
page = requests.get('https://translate.sugarlabs.org/about/contributors/')
content = page.content
file(cache, 'w').write(content)
else:
content = file(cache, 'r').read()
tree = html.fromstring(content)
users = []
for lang in tree.find_class('lang'):
for proj in lang.find_class('proj'):
name = proj.text.strip()
if name == 'sugar' or name == 'sugar-toolkit-gtk3':
for user in proj.find_class('user'):
name = user.text.strip()
if name not in users:
users.append(name)
users.sort()
for name in users:
print name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment