diff options
author | bashonly <88596187+bashonly@users.noreply.github.com> | 2025-03-21 18:04:58 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-21 23:04:58 +0000 |
commit | f5fb2229e66cf59d5bf16065bc041b42a28354a0 (patch) | |
tree | ff1a9f2300efe9f84a17a07691079add3b31e099 /yt_dlp/extractor/bilibili.py | |
parent | 89a68c4857ddbaf937ff22f12648baaf6b5af840 (diff) |
[ie/BilibiliPlaylist] Fix extractor (#12690)
Closes #12651
Authored by: bashonly
Diffstat (limited to 'yt_dlp/extractor/bilibili.py')
-rw-r--r-- | yt_dlp/extractor/bilibili.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/yt_dlp/extractor/bilibili.py b/yt_dlp/extractor/bilibili.py index 42b4e2d3c..6508942a4 100644 --- a/yt_dlp/extractor/bilibili.py +++ b/yt_dlp/extractor/bilibili.py @@ -1596,16 +1596,16 @@ class BilibiliPlaylistIE(BilibiliSpaceListBaseIE): webpage = self._download_webpage(url, list_id) initial_state = self._search_json(r'window\.__INITIAL_STATE__\s*=', webpage, 'initial state', list_id) - if traverse_obj(initial_state, ('error', 'code', {int_or_none})) != 200: - error_code = traverse_obj(initial_state, ('error', 'trueCode', {int_or_none})) - error_message = traverse_obj(initial_state, ('error', 'message', {str_or_none})) + error = traverse_obj(initial_state, (('error', 'listError'), all, lambda _, v: v['code'], any)) + if error and error['code'] != 200: + error_code = error.get('trueCode') if error_code == -400 and list_id == 'watchlater': self.raise_login_required('You need to login to access your watchlater playlist') elif error_code == -403: self.raise_login_required('This is a private playlist. You need to login as its owner') elif error_code == 11010: raise ExtractorError('Playlist is no longer available', expected=True) - raise ExtractorError(f'Could not access playlist: {error_code} {error_message}') + raise ExtractorError(f'Could not access playlist: {error_code} {error.get("message")}') query = { 'ps': 20, |