mirror of
https://gh.wpcy.net/https://github.com/WeblateOrg/weblate.git
synced 2026-04-26 10:52:09 +08:00
31 lines
672 B
Python
Executable file
31 lines
672 B
Python
Executable file
#!/usr/bin/env python
|
|
|
|
# Copyright © Michal Čihař <michal@weblate.org>
|
|
#
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
import re
|
|
|
|
import requests
|
|
|
|
URL = "https://docs.aws.amazon.com/translate/latest/dg/what-is.html"
|
|
|
|
LANG_RE = re.compile(".*<td> *([a-z][a-z](-[A-Z][A-Z])?) *</td>.*")
|
|
|
|
CODES = set()
|
|
|
|
response = requests.get(URL, timeout=1)
|
|
parse = False
|
|
for line in response.text.splitlines():
|
|
if parse:
|
|
match = LANG_RE.match(line)
|
|
if match:
|
|
CODES.add(match[1])
|
|
elif "</table>" in line:
|
|
break
|
|
elif "<th>Language Code" in line:
|
|
parse = True
|
|
|
|
|
|
for code in sorted(CODES):
|
|
print(f" {code!r},")
|