Skip to content

Commit 86d735f

Browse files
Update aplm.py
1 parent 27bf1b4 commit 86d735f

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

core/api/aplm.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,13 @@ def __parse_url(self, url):
5757
if u.query:
5858
self.songId = u.query.replace('i=', '')
5959

60+
if self.kind == 'song':
61+
r = self.session.get(f"https://amp-api.music.apple.com/v1/catalog/us/songs/{self.id}")
62+
r = json.loads(r.text)
63+
self.kind = 'album'
64+
self.songId = self.id
65+
self.id = r['data'][0]['relationships']['albums']['data'][0]['id']
66+
6067
logger.debug(f'UrlParseResult(kind="{self.kind}", id="{self.id}", songId="{self.songId}")')
6168
else:
6269
logger.error("Url is invalid!", 1)

0 commit comments

Comments
 (0)