import requests
import json

path_to_translations = 'https://www.thenewsspy.com/i18n'
most_common_languages = ["default", "en", "de", "ar", "ru", "es", "fr", "no", "dk", "fi", "se", "nl", "it", "pt"]

for language in most_common_languages:
    response = requests.get(f'{path_to_translations}/{language.lower()}.json')

    if response.status_code == 200:
        print(f'Saving "{language.upper()}"')
        with open(f'{language.lower()}.json', 'w') as f:
            json.dump(response.json(), f)
    elif response.status_code == 404:
        print(f'"{language.upper()}" Not Found.')
