From 12f033d56bb8a6b02a7f3fff7aad97644b2b93c6 Mon Sep 17 00:00:00 2001 From: kokarare1212 Date: Sun, 25 Apr 2021 09:15:56 +0900 Subject: [PATCH] Fix Preload error handling --- librespot/audio/cdn/CdnManager.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/librespot/audio/cdn/CdnManager.py b/librespot/audio/cdn/CdnManager.py index 65da13f..efd4d18 100644 --- a/librespot/audio/cdn/CdnManager.py +++ b/librespot/audio/cdn/CdnManager.py @@ -119,7 +119,11 @@ class CdnManager: if self._fileId is not None: token_url = urllib.parse.urlparse(url) token_query = urllib.parse.parse_qs(token_url.query) - token_str = str(token_query.get("__token__")[0]) + token_list = token_query.get("__token__") + try: + token_str = str(token_list[0]) + except TypeError: + token_str = "" if token_str != "None" and len(token_str) != 0: expire_at = None split = token_str.split("~")