dmdhrumilmistry / MusicAPy

A Python wrapper for Jio Saavn API
https://dmdhrumilmistry.github.io/MusicAPy/
MIT License
2 stars 3 forks source link

Playlist services errors #13

Closed arsaboo closed 1 year ago

arsaboo commented 1 year ago

Just tried the playlist services (using the code in the PR). With the regular playlist link, I get the following error:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
[c:\Users\arsab\Desktop\Jupyter\apple_music.ipynb](file:///C:/Users/arsab/Desktop/Jupyter/apple_music.ipynb) Cell 53 in ()
     [10](vscode-notebook-cell:/c%3A/Users/arsab/Desktop/Jupyter/apple_music.ipynb#Y103sZmlsZQ%3D%3D?line=9) id = api.create_identifier('https://www.jiosaavn.com/s/playlist/a60306bf0bd5cacc95a888a361163e07/Ppll/Iz0pi7nkjUHfemJ68FuXsA__', 'playlist')
     [12](vscode-notebook-cell:/c%3A/Users/arsab/Desktop/Jupyter/apple_music.ipynb#Y103sZmlsZQ%3D%3D?line=11) # with playlist/list id
     [13](vscode-notebook-cell:/c%3A/Users/arsab/Desktop/Jupyter/apple_music.ipynb#Y103sZmlsZQ%3D%3D?line=12) # id = api.create_identifier(802336660, 'playlist')
---> [15](vscode-notebook-cell:/c%3A/Users/arsab/Desktop/Jupyter/apple_music.ipynb#Y103sZmlsZQ%3D%3D?line=14) playlist_details = api.get_playlist_details(id)
     [16](vscode-notebook-cell:/c%3A/Users/arsab/Desktop/Jupyter/apple_music.ipynb#Y103sZmlsZQ%3D%3D?line=15) pprint(playlist_details)
     [18](vscode-notebook-cell:/c%3A/Users/arsab/Desktop/Jupyter/apple_music.ipynb#Y103sZmlsZQ%3D%3D?line=17) songs_details = api.get_playlist_song_download_links(id)

AttributeError: 'SaavnAPI' object has no attribute 'get_playlist_details'

With featured playlists, here's the error that I got:

Output exceeds the [size limit](command:workbench.action.openSettings?%5B%22notebook.output.textLineLimit%22%5D). Open the full output data [in a text editor](command:workbench.action.openLargeOutput?18492e88-1372-40ef-8fdd-b39e0703303a)
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
[c:\Users\arsab\Desktop\Jupyter\apple_music.ipynb](file:///C:/Users/arsab/Desktop/Jupyter/apple_music.ipynb) Cell 53 in ()
      [4](vscode-notebook-cell:/c%3A/Users/arsab/Desktop/Jupyter/apple_music.ipynb#Y103sZmlsZQ%3D%3D?line=3) api = SaavnAPI()
      [6](vscode-notebook-cell:/c%3A/Users/arsab/Desktop/Jupyter/apple_music.ipynb#Y103sZmlsZQ%3D%3D?line=5) # with featured playlist link
----> [7](vscode-notebook-cell:/c%3A/Users/arsab/Desktop/Jupyter/apple_music.ipynb#Y103sZmlsZQ%3D%3D?line=6) id = api.create_identifier('https://www.jiosaavn.com/featured/arijits-sad-songs/8RkefqkCO1huOxiEGmm6lQ__', None)
      [9](vscode-notebook-cell:/c%3A/Users/arsab/Desktop/Jupyter/apple_music.ipynb#Y103sZmlsZQ%3D%3D?line=8) # with playlist link
     [10](vscode-notebook-cell:/c%3A/Users/arsab/Desktop/Jupyter/apple_music.ipynb#Y103sZmlsZQ%3D%3D?line=9) #id = api.create_identifier('https://www.jiosaavn.com/s/playlist/a60306bf0bd5cacc95a888a361163e07/Ppll/Iz0pi7nkjUHfemJ68FuXsA__', 'playlist')
     [11](vscode-notebook-cell:/c%3A/Users/arsab/Desktop/Jupyter/apple_music.ipynb#Y103sZmlsZQ%3D%3D?line=10) 
     [12](vscode-notebook-cell:/c%3A/Users/arsab/Desktop/Jupyter/apple_music.ipynb#Y103sZmlsZQ%3D%3D?line=11) # with playlist/list id
     [13](vscode-notebook-cell:/c%3A/Users/arsab/Desktop/Jupyter/apple_music.ipynb#Y103sZmlsZQ%3D%3D?line=12) # id = api.create_identifier(802336660, 'playlist')
     [15](vscode-notebook-cell:/c%3A/Users/arsab/Desktop/Jupyter/apple_music.ipynb#Y103sZmlsZQ%3D%3D?line=14) playlist_details = api.get_playlist_details(id)

File [c:\Users\arsab\anaconda3\lib\site-packages\musicapy\saavn_api\utils.py:16](file:///C:/Users/arsab/anaconda3/lib/site-packages/musicapy/saavn_api/utils.py:16), in Utils.create_identifier(link, identifier_type)
      4 '''Creates identifier dict used with SongService to perform various actions.
      5 
      6 :param link: str value containing link of the JioSaavn song/album
   (...)
     10 :rtype: dict  
     11 '''
     12 ID = None
     14 identifier = {
     15     'type': 'id' if ID else 'link',
---> 16     'value': str(ID) if ID else Utils.extract_id_from_link(link, identifier_type)
     17 }
...
     29     :rtype: str
     30     '''
---> 31     return link.split(f'{identifier_type}/')[1].split('/')[-1]

IndexError: list index out of range
dmdhrumilmistry commented 1 year ago

I haven't updated the library on PyPi yet. you can use below command to install latest package.

python3 -m pip install git+https://github.com/dmdhrumilmistry/MusicAPy
arsaboo commented 1 year ago

Yes, I'm installing directly from GitHub. I'll try again with the latest fix

dmdhrumilmistry commented 1 year ago

Yeah sure.

You can reopen issue if you're still facing issues.