get_album_browse_id: fix DeprecationWarning on Python 3.12
This commit is contained in:
parent
170eea358d
commit
c8af65d643
1 changed files with 5 additions and 1 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
import re
|
import re
|
||||||
|
import warnings
|
||||||
from typing import Any, Dict, List, Optional
|
from typing import Any, Dict, List, Optional
|
||||||
|
|
||||||
from ytmusicapi.continuations import (
|
from ytmusicapi.continuations import (
|
||||||
|
|
@ -423,7 +424,10 @@ class BrowsingMixin(MixinProtocol):
|
||||||
params = {"list": audioPlaylistId}
|
params = {"list": audioPlaylistId}
|
||||||
response = self._send_get_request(YTM_DOMAIN + "/playlist", params)
|
response = self._send_get_request(YTM_DOMAIN + "/playlist", params)
|
||||||
|
|
||||||
matches = re.search(r"\"MPRE.+?\"", response.text.encode("utf8").decode("unicode_escape"))
|
with warnings.catch_warnings(action="ignore", category=DeprecationWarning):
|
||||||
|
decoded = response.text.encode("utf8").decode("unicode_escape")
|
||||||
|
|
||||||
|
matches = re.search(r"\"MPRE.+?\"", decoded)
|
||||||
browse_id = None
|
browse_id = None
|
||||||
if matches:
|
if matches:
|
||||||
browse_id = matches.group().strip('"')
|
browse_id = matches.group().strip('"')
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue