diff --git a/ytmusicapi/locales/README.rst b/ytmusicapi/locales/README.rst index 8afe2c9..11e423c 100644 --- a/ytmusicapi/locales/README.rst +++ b/ytmusicapi/locales/README.rst @@ -10,7 +10,7 @@ This package uses the Linux command line utility xgettext, which you can install Add new translatable texts from code ---------------------------------------- -``xgettext -d base -o locales/base.pot ytmusicapi/*.py`` +``xgettext -d base -o locales/base.pot *.py mixins/*.py parsers/*.py`` ``sed --in-place locales/base.pot --expression=s/CHARSET/UTF-8/`` diff --git a/ytmusicapi/locales/base.pot b/ytmusicapi/locales/base.pot index c1e1610..3fab18e 100644 --- a/ytmusicapi/locales/base.pot +++ b/ytmusicapi/locales/base.pot @@ -1,14 +1,14 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. +# Translations for ytmusicapi +# Copyright (C) 2021 sigma67 +# This file is distributed under the same license as ytmusicapi +# sigma67 # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-07-21 09:15+0200\n" +"POT-Creation-Date: 2021-02-01 14:31+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,34 +17,38 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: ytmusicapi/parsers.py:44 +#: parsers/browsing.py:21 msgid "artist" msgstr "" -#: ytmusicapi/parsers.py:44 +#: parsers/browsing.py:21 msgid "playlist" msgstr "" -#: ytmusicapi/parsers.py:44 +#: parsers/browsing.py:21 msgid "song" msgstr "" -#: ytmusicapi/parsers.py:44 +#: parsers/browsing.py:21 msgid "video" msgstr "" -#: ytmusicapi/parsers.py:93 +#: parsers/browsing.py:21 +msgid "station" +msgstr "" + +#: parsers/browsing.py:123 msgid "albums" msgstr "" -#: ytmusicapi/parsers.py:93 +#: parsers/browsing.py:123 msgid "singles" msgstr "" -#: ytmusicapi/parsers.py:93 +#: parsers/browsing.py:123 msgid "videos" msgstr "" -#: ytmusicapi/parsers.py:93 +#: parsers/browsing.py:123 msgid "playlists" msgstr "" diff --git a/ytmusicapi/locales/de/LC_MESSAGES/base.mo b/ytmusicapi/locales/de/LC_MESSAGES/base.mo index 069bdec..87f1c26 100644 Binary files a/ytmusicapi/locales/de/LC_MESSAGES/base.mo and b/ytmusicapi/locales/de/LC_MESSAGES/base.mo differ diff --git a/ytmusicapi/locales/de/LC_MESSAGES/base.po b/ytmusicapi/locales/de/LC_MESSAGES/base.po index 7459d48..bf84f57 100644 --- a/ytmusicapi/locales/de/LC_MESSAGES/base.po +++ b/ytmusicapi/locales/de/LC_MESSAGES/base.po @@ -1,14 +1,14 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. +# Translations for ytmusicapi +# Copyright (C) 2021 sigma67 +# This file is distributed under the same license as ytmusicapi +# sigma67 # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-07-21 09:15+0200\n" +"POT-Creation-Date: 2021-02-01 14:31+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,37 +17,38 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: ytmusicapi/parsers.py:44 +#: parsers/browsing.py:21 msgid "artist" msgstr "künstler" -#: ytmusicapi/parsers.py:44 +#: parsers/browsing.py:21 msgid "playlist" msgstr "playlist" -#: ytmusicapi/parsers.py:44 +#: parsers/browsing.py:21 msgid "song" msgstr "titel" -#: ytmusicapi/parsers.py:44 +#: parsers/browsing.py:21 msgid "video" msgstr "video" -#: ytmusicapi/parsers.py:93 +#: parsers/browsing.py:21 +msgid "station" +msgstr "sender" + +#: parsers/browsing.py:123 msgid "albums" msgstr "alben" -#: ytmusicapi/parsers.py:93 +#: parsers/browsing.py:123 msgid "singles" msgstr "singles" -#: ytmusicapi/parsers.py:93 +#: parsers/browsing.py:123 msgid "videos" msgstr "videos" -#: ytmusicapi/parsers.py:93 +#: parsers/browsing.py:123 msgid "playlists" msgstr "playlists" - -#~ msgid "album" -#~ msgstr "album" diff --git a/ytmusicapi/locales/en/LC_MESSAGES/base.mo b/ytmusicapi/locales/en/LC_MESSAGES/base.mo index 88b4778..ff4f7f4 100644 Binary files a/ytmusicapi/locales/en/LC_MESSAGES/base.mo and b/ytmusicapi/locales/en/LC_MESSAGES/base.mo differ diff --git a/ytmusicapi/locales/en/LC_MESSAGES/base.po b/ytmusicapi/locales/en/LC_MESSAGES/base.po index 675d204..f419e30 100644 --- a/ytmusicapi/locales/en/LC_MESSAGES/base.po +++ b/ytmusicapi/locales/en/LC_MESSAGES/base.po @@ -1,14 +1,14 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. +# Translations for ytmusicapi +# Copyright (C) 2021 sigma67 +# This file is distributed under the same license as ytmusicapi +# sigma67 # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-07-21 09:15+0200\n" +"POT-Creation-Date: 2021-02-01 14:31+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,34 +17,38 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: ytmusicapi/parsers.py:44 +#: parsers/browsing.py:21 msgid "artist" msgstr "" -#: ytmusicapi/parsers.py:44 +#: parsers/browsing.py:21 msgid "playlist" msgstr "" -#: ytmusicapi/parsers.py:44 +#: parsers/browsing.py:21 msgid "song" msgstr "" -#: ytmusicapi/parsers.py:44 +#: parsers/browsing.py:21 msgid "video" msgstr "" -#: ytmusicapi/parsers.py:93 +#: parsers/browsing.py:21 +msgid "station" +msgstr "" + +#: parsers/browsing.py:123 msgid "albums" msgstr "" -#: ytmusicapi/parsers.py:93 +#: parsers/browsing.py:123 msgid "singles" msgstr "" -#: ytmusicapi/parsers.py:93 +#: parsers/browsing.py:123 msgid "videos" msgstr "" -#: ytmusicapi/parsers.py:93 +#: parsers/browsing.py:123 msgid "playlists" msgstr "" diff --git a/ytmusicapi/locales/es/LC_MESSAGES/base.mo b/ytmusicapi/locales/es/LC_MESSAGES/base.mo index 85b0a60..4fc1452 100644 Binary files a/ytmusicapi/locales/es/LC_MESSAGES/base.mo and b/ytmusicapi/locales/es/LC_MESSAGES/base.mo differ diff --git a/ytmusicapi/locales/es/LC_MESSAGES/base.po b/ytmusicapi/locales/es/LC_MESSAGES/base.po index eab418f..6c93e4a 100644 --- a/ytmusicapi/locales/es/LC_MESSAGES/base.po +++ b/ytmusicapi/locales/es/LC_MESSAGES/base.po @@ -1,14 +1,14 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. +# Translations for ytmusicapi +# Copyright (C) 2021 sigma67 +# This file is distributed under the same license as ytmusicapi +# sigma67 # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-07-21 09:15+0200\n" +"POT-Creation-Date: 2021-02-01 14:31+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,37 +17,38 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: ytmusicapi/parsers.py:44 +#: parsers/browsing.py:21 msgid "artist" msgstr "artista" -#: ytmusicapi/parsers.py:44 +#: parsers/browsing.py:21 msgid "playlist" msgstr "lista de reproducción" -#: ytmusicapi/parsers.py:44 +#: parsers/browsing.py:21 msgid "song" msgstr "canción" -#: ytmusicapi/parsers.py:44 +#: parsers/browsing.py:21 msgid "video" msgstr "vídeo" -#: ytmusicapi/parsers.py:93 +#: parsers/browsing.py:21 +msgid "station" +msgstr "emisora" + +#: parsers/browsing.py:123 msgid "albums" msgstr "álbumes" -#: ytmusicapi/parsers.py:93 +#: parsers/browsing.py:123 msgid "singles" msgstr "sencillos" -#: ytmusicapi/parsers.py:93 +#: parsers/browsing.py:123 msgid "videos" msgstr "vídeos" -#: ytmusicapi/parsers.py:93 +#: parsers/browsing.py:123 msgid "playlists" msgstr "listas de reproducción" - -#~ msgid "album" -#~ msgstr "álbum" diff --git a/ytmusicapi/locales/fr/LC_MESSAGES/base.mo b/ytmusicapi/locales/fr/LC_MESSAGES/base.mo index 8c81d58..b670a8d 100644 Binary files a/ytmusicapi/locales/fr/LC_MESSAGES/base.mo and b/ytmusicapi/locales/fr/LC_MESSAGES/base.mo differ diff --git a/ytmusicapi/locales/fr/LC_MESSAGES/base.po b/ytmusicapi/locales/fr/LC_MESSAGES/base.po index f133c52..e48df2a 100644 --- a/ytmusicapi/locales/fr/LC_MESSAGES/base.po +++ b/ytmusicapi/locales/fr/LC_MESSAGES/base.po @@ -1,14 +1,14 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. +# Translations for ytmusicapi +# Copyright (C) 2021 sigma67 +# This file is distributed under the same license as ytmusicapi +# sigma67 # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-07-21 09:15+0200\n" +"POT-Creation-Date: 2021-02-01 14:31+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,37 +17,38 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: ytmusicapi/parsers.py:44 +#: parsers/browsing.py:21 msgid "artist" msgstr "artiste" -#: ytmusicapi/parsers.py:44 +#: parsers/browsing.py:21 msgid "playlist" msgstr "playlist" -#: ytmusicapi/parsers.py:44 +#: parsers/browsing.py:21 msgid "song" msgstr "titre" -#: ytmusicapi/parsers.py:44 +#: parsers/browsing.py:21 msgid "video" msgstr "vidéo" -#: ytmusicapi/parsers.py:93 +#: parsers/browsing.py:21 +msgid "station" +msgstr "radio" + +#: parsers/browsing.py:123 msgid "albums" -msgstr "albums" +msgstr "" -#: ytmusicapi/parsers.py:93 +#: parsers/browsing.py:123 msgid "singles" -msgstr "singles" +msgstr "" -#: ytmusicapi/parsers.py:93 +#: parsers/browsing.py:123 msgid "videos" msgstr "vidéos" -#: ytmusicapi/parsers.py:93 +#: parsers/browsing.py:123 msgid "playlists" -msgstr "playlists" - -#~ msgid "album" -#~ msgstr "album" +msgstr "" diff --git a/ytmusicapi/locales/it/LC_MESSAGES/base.mo b/ytmusicapi/locales/it/LC_MESSAGES/base.mo index 5256466..f879c91 100644 Binary files a/ytmusicapi/locales/it/LC_MESSAGES/base.mo and b/ytmusicapi/locales/it/LC_MESSAGES/base.mo differ diff --git a/ytmusicapi/locales/it/LC_MESSAGES/base.po b/ytmusicapi/locales/it/LC_MESSAGES/base.po index d6b3833..5b82b80 100644 --- a/ytmusicapi/locales/it/LC_MESSAGES/base.po +++ b/ytmusicapi/locales/it/LC_MESSAGES/base.po @@ -1,14 +1,14 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. +# Translations for ytmusicapi +# Copyright (C) 2021 sigma67 +# This file is distributed under the same license as ytmusicapi +# sigma67 # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-07-21 09:15+0200\n" +"POT-Creation-Date: 2021-02-01 14:31+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,37 +17,38 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: ytmusicapi/parsers.py:44 +#: parsers/browsing.py:21 msgid "artist" msgstr "artista" -#: ytmusicapi/parsers.py:44 +#: parsers/browsing.py:21 msgid "playlist" -msgstr "playlist" +msgstr "" -#: ytmusicapi/parsers.py:44 +#: parsers/browsing.py:21 msgid "song" msgstr "brano" -#: ytmusicapi/parsers.py:44 +#: parsers/browsing.py:21 msgid "video" -msgstr "video" +msgstr "" -#: ytmusicapi/parsers.py:93 +#: parsers/browsing.py:21 +msgid "station" +msgstr "stazione" + +#: parsers/browsing.py:123 msgid "albums" msgstr "album" -#: ytmusicapi/parsers.py:93 +#: parsers/browsing.py:123 msgid "singles" msgstr "singoli" -#: ytmusicapi/parsers.py:93 +#: parsers/browsing.py:123 msgid "videos" msgstr "video" -#: ytmusicapi/parsers.py:93 +#: parsers/browsing.py:123 msgid "playlists" msgstr "playlist" - -#~ msgid "album" -#~ msgstr "album" diff --git a/ytmusicapi/locales/ja/LC_MESSAGES/base.mo b/ytmusicapi/locales/ja/LC_MESSAGES/base.mo index 043192c..71452b5 100644 Binary files a/ytmusicapi/locales/ja/LC_MESSAGES/base.mo and b/ytmusicapi/locales/ja/LC_MESSAGES/base.mo differ diff --git a/ytmusicapi/locales/ja/LC_MESSAGES/base.po b/ytmusicapi/locales/ja/LC_MESSAGES/base.po index 5a36e61..b441079 100644 --- a/ytmusicapi/locales/ja/LC_MESSAGES/base.po +++ b/ytmusicapi/locales/ja/LC_MESSAGES/base.po @@ -1,14 +1,14 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. +# Translations for ytmusicapi +# Copyright (C) 2021 sigma67 +# This file is distributed under the same license as ytmusicapi +# sigma67 # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-07-21 09:15+0200\n" +"POT-Creation-Date: 2021-02-01 14:31+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,37 +17,38 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: ytmusicapi/parsers.py:44 +#: parsers/browsing.py:21 msgid "artist" msgstr "アーティスト" -#: ytmusicapi/parsers.py:44 +#: parsers/browsing.py:21 msgid "playlist" msgstr "プレイリスト" -#: ytmusicapi/parsers.py:44 +#: parsers/browsing.py:21 msgid "song" msgstr "曲" -#: ytmusicapi/parsers.py:44 +#: parsers/browsing.py:21 msgid "video" msgstr "動画" -#: ytmusicapi/parsers.py:93 +#: parsers/browsing.py:21 +msgid "station" +msgstr "ステーション" + +#: parsers/browsing.py:123 msgid "albums" msgstr "アルバム" -#: ytmusicapi/parsers.py:93 +#: parsers/browsing.py:123 msgid "singles" msgstr "シングル" -#: ytmusicapi/parsers.py:93 +#: parsers/browsing.py:123 msgid "videos" msgstr "動画" -#: ytmusicapi/parsers.py:93 +#: parsers/browsing.py:123 msgid "playlists" msgstr "プレイリスト" - -#~ msgid "album" -#~ msgstr "アルバム" diff --git a/ytmusicapi/parsers/browsing.py b/ytmusicapi/parsers/browsing.py index 37382e0..ab62b05 100644 --- a/ytmusicapi/parsers/browsing.py +++ b/ytmusicapi/parsers/browsing.py @@ -17,8 +17,12 @@ class Parser: search_result = {} if not resultType: resultType = get_item_text(data, 1).lower() - result_types = ['artist', 'playlist', 'song', 'video'] - result_types_local = [_('artist'), _('playlist'), _('song'), _('video')] + result_types = ['artist', 'playlist', 'song', 'video', 'station'] + result_types_local = [ + _('artist'), _('playlist'), + _('song'), _('video'), + _('station') + ] # default to album since it's labeled with multiple values ('Single', 'EP', etc.) if resultType not in result_types_local: resultType = 'album' @@ -27,23 +31,28 @@ class Parser: search_result['resultType'] = resultType - if resultType in ['artist']: + if resultType != 'artist': + search_result['title'] = get_item_text(data, 0) + + if resultType == 'artist': search_result['artist'] = get_item_text(data, 0) parse_menu_playlists(data, search_result) - elif resultType in ['album']: - search_result['title'] = get_item_text(data, 0) + elif resultType == 'album': search_result['type'] = get_item_text(data, 1) search_result['artist'] = get_item_text(data, 1, 2) search_result['year'] = get_item_text(data, 1, 4, True) - elif resultType in ['playlist']: - search_result['title'] = get_item_text(data, 0) + elif resultType == 'playlist': search_result['author'] = get_item_text(data, 1, default_offset) search_result['itemCount'] = get_item_text(data, 1, - default_offset + 2).split(' ')[0] + default_offset + 2).split('\xa0')[0] - elif resultType in ['song']: + elif resultType == 'station': + search_result['videoId'] = nav(data, NAVIGATION_VIDEO_ID) + search_result['playlistId'] = nav(data, NAVIGATION_PLAYLIST_ID) + + elif resultType == 'song': search_result['duration'] = None if 'menu' in data: toggle_menu = find_object_by_key(nav(data, MENU_ITEMS), @@ -51,12 +60,10 @@ class Parser: if toggle_menu: search_result['feedbackTokens'] = parse_song_menu_tokens(toggle_menu) - elif resultType in ['video']: + elif resultType == 'video': search_result['views'] = None - elif resultType in ['upload']: - search_result['title'] = get_item_text(data, 0) - + elif resultType == 'upload': browse_id = nav(data, NAVIGATION_BROWSE_ID, True) if not browse_id: # song result flex_items = [ @@ -97,7 +104,6 @@ class Parser: search_result['videoId'] = nav( data, PLAY_BUTTON + ['playNavigationEndpoint', 'watchEndpoint', 'videoId'], True) - search_result['title'] = get_item_text(data, 0) song_info = parse_song_runs(get_flex_column_item(data, 1)['text']['runs']) search_result.update(song_info) diff --git a/ytmusicapi/parsers/utils.py b/ytmusicapi/parsers/utils.py index 05c1773..1600b10 100644 --- a/ytmusicapi/parsers/utils.py +++ b/ytmusicapi/parsers/utils.py @@ -22,10 +22,7 @@ def parse_song_runs(runs): for run in runs: text = run['text'] if 'navigationEndpoint' in run: # artist or album - item = { - 'name': text, - 'id': nav(run, NAVIGATION_BROWSE_ID, True) - } + item = {'name': text, 'id': nav(run, NAVIGATION_BROWSE_ID, True)} if item['id'] and item['id'].startswith('MPRE'): # album parsed['album'] = item @@ -33,7 +30,8 @@ def parse_song_runs(runs): parsed['artists'].append(item) else: - if text.endswith(' views'): + # note: YT uses non-breaking space \xa0 to separate number and magnitude + if re.match(r"^\d([^ ])* [^ ]*$", text): parsed['views'] = text.split(' ')[0] elif re.match(r"^(\d+:)*\d+:\d+$", text): diff --git a/ytmusicapi/ytmusic.py b/ytmusicapi/ytmusic.py index 2ff06fa..87fb511 100644 --- a/ytmusicapi/ytmusic.py +++ b/ytmusicapi/ytmusic.py @@ -24,7 +24,6 @@ class YTMusic(BrowsingMixin, WatchMixin, LibraryMixin, PlaylistsMixin, UploadsMi Permits both authenticated and non-authenticated requests. Authentication header data must be provided on initialization. """ - def __init__(self, auth: str = None, user: str = None, @@ -84,11 +83,9 @@ class YTMusic(BrowsingMixin, WatchMixin, LibraryMixin, PlaylistsMixin, UploadsMi with open(pkg_resources.resource_filename('ytmusicapi', 'context.json')) as json_file: self.context = json.load(json_file) - + self.context['context']['client']['hl'] = language - supported_languages = [ - f for f in pkg_resources.resource_listdir('ytmusicapi', 'locales') - ] + supported_languages = [f for f in pkg_resources.resource_listdir('ytmusicapi', 'locales')] if language not in supported_languages: raise Exception("Language not supported. Supported languages are " ', '.join(supported_languages)) @@ -96,8 +93,8 @@ class YTMusic(BrowsingMixin, WatchMixin, LibraryMixin, PlaylistsMixin, UploadsMi try: locale.setlocale(locale.LC_ALL, self.language) except locale.Error: - with suppress(locale.Error): - locale.setlocale(locale.LC_ALL, 'en_US.UTF-8') + with suppress(locale.Error): + locale.setlocale(locale.LC_ALL, 'en_US.UTF-8') self.lang = gettext.translation('base', localedir=pkg_resources.resource_filename( 'ytmusicapi', 'locales'),