Created
June 1, 2021 11:57
-
-
Save flodolo/04fbcff16096223439168a2bf77f956d to your computer and use it in GitHub Desktop.
Check Widevine translation status
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python3 | |
from urllib.request import urlopen | |
import json | |
ids = [ | |
"cfr-doorhanger-video-support-body", | |
"cfr-doorhanger-video-support-header", | |
"cfr-doorhanger-video-support-primary-button", | |
"cfr-doorhanger-video-support-primary-button.accesskey", | |
] | |
base_url = "https://transvision.flod.org/api/v1/entity/gecko_strings/?id=browser/browser/newtab/asrouter.ftl:{}" | |
locales = {} | |
for id in ids: | |
try: | |
url = base_url.format(id) | |
response = urlopen(url) | |
json_data = json.load(response) | |
for locale in json_data.keys(): | |
if locale in locales: | |
locales[locale] += 1 | |
else: | |
locales[locale] = 1 | |
except Exception as e: | |
print(e) | |
complete_locales = [] | |
for locale, count in locales.items(): | |
if count == len(ids): | |
complete_locales.append(locale) | |
print("Locales complete: " + ", ".join(complete_locales)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment