From ceac9f669d8c4d1a65d64fda253fcf0ab8e6d25c Mon Sep 17 00:00:00 2001 From: c-basalt <117849907+c-basalt@users.noreply.github.com> Date: Thu, 19 Sep 2024 19:21:43 -0400 Subject: [PATCH] Update neteasemusic.py --- yt_dlp/extractor/neteasemusic.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/yt_dlp/extractor/neteasemusic.py b/yt_dlp/extractor/neteasemusic.py index e899e3003..4865331ba 100644 --- a/yt_dlp/extractor/neteasemusic.py +++ b/yt_dlp/extractor/neteasemusic.py @@ -79,7 +79,8 @@ class NetEaseMusicBaseIE(InfoExtractor): def _call_player_api(self, song_id, level, headers={}): return self._download_eapi_json( '/song/enhance/player/url/v1', song_id, - {'ids': f'[{song_id}]', 'level': level, 'encodeType': 'flac'}, headers=headers, note=f'Downloading song URL info: level {level}') + {'ids': f'[{song_id}]', 'level': level, 'encodeType': 'flac'}, + headers=headers, note=f'Downloading song URL info: level {level}') def _extract_formats(self, info, try_geo_bypass=False): formats = [] @@ -88,10 +89,10 @@ class NetEaseMusicBaseIE(InfoExtractor): for level in self._LEVELS: song = traverse_obj( self._call_player_api(song_id, level, headers=headers), ('data', lambda _, v: url_or_none(v['url']), any)) - if not song: + if not song: # Media is not available due to removal or geo-restriction if not try_geo_bypass: return self._extract_formats(info, try_geo_bypass=True) - break # Media is not available due to removal or geo-restriction + break actual_level = song.get('level') if actual_level and actual_level != level: if level in ('lossless', 'jymaster'):