Feature: add get_album_browse_id (#186)
This commit is contained in:
parent
e5b46cc79c
commit
bfe26e9b1f
2 changed files with 30 additions and 8 deletions
|
|
@ -409,6 +409,21 @@ class BrowsingMixin:
|
|||
|
||||
return user_playlists
|
||||
|
||||
def get_album_browse_id(self, audioPlaylistId: str):
|
||||
"""
|
||||
Get an album's browseId based on its audioPlaylistId
|
||||
:param audioPlaylistId: id of the audio playlist (starting with `OLAK5uy_`)
|
||||
:return: browseId (starting with `MPREb_`)
|
||||
"""
|
||||
endpoint = "https://music.youtube.com/playlist"
|
||||
params = {"list": audioPlaylistId}
|
||||
response = requests.get(endpoint, params, headers=self.headers, proxies=self.proxies)
|
||||
matches = re.findall(r"\"MPRE.+?\"", response.text)
|
||||
browse_id = None
|
||||
if len(matches) > 0:
|
||||
browse_id = matches[0].encode('utf8').decode('unicode-escape').strip('"')
|
||||
return browse_id
|
||||
|
||||
def get_album(self, browseId: str, beta: bool = False) -> Dict:
|
||||
"""
|
||||
Get information and tracks of an album
|
||||
|
|
|
|||
Loading…
Reference in a new issue