Giter VIP home page Giter VIP logo

musicapy's Introduction

MusicAPy

Music API Python wrapper, currently supports limited API.

  • Supported API
    • JioSaavn

Docs Deployment Status

Deploy Docs

Installation

  • Using pip and git

    python3 -m pip install git+https://github.com/dmdhrumilmistry/MusicAPy
  • Using pypi

    python3 -m pip install MusicAPy

Usage

  • Jio Saavn API

    • From Script

      from musicapy.saavn_api.api import SaavnAPI
      
      # create API obj
      api = SaavnAPI()
      
      
      ## Search Services
      # Search Song
      data = api.search_song('song_name')
      
      # Search Album
      data = api.search_album('album_name')
      
      # Search All
      data = api.search_all('song_or_album_name')
      
      ## Song Services
      # get song link
      saavn_song_link = 'https://www.jiosaavn.com/song/song_name/id'
      
      # create identifier
      identifier = api.create_identifier(link, 'song')
      
      # get trending songs
      trending_songs = api.get_trending()
      
      # get latest charts
      charts = api.get_charts()
      
      # get song link from identifier
      song_link = api.get_song_link(identifier)
      
      # get song details
      details = api.get_song_details(identifier)
      
      # get song lyrics
      lyrics = api.get_song_lyrics(identifier)
      
      # get download links
      download_links = api.generate_song_download_links(identifier)
      
      ## Albums Service
      # get song details
      album_details = api.get_album_details(identifier)
      
      # get album songs download links
      data = api.generate_album_download_links(identifier) 
      
      ## Playlist Service
      # with featured playlist link
      id = api.create_identifier('https://www.jiosaavn.com/featured/arijits-sad-songs/8RkefqkCO1huOxiEGmm6lQ__', None)
      
      # with playlist link
      id = api.create_identifier('https://www.jiosaavn.com/s/playlist/a60306bf0bd5cacc95a888a361163e07/Ppll/Iz0pi7nkjUHfemJ68FuXsA__', 'playlist')
      
      # with playlist/list id
      id = api.create_identifier(802336660, 'playlist')
      
      # fetch playlist details
      playlist_details = api.get_playlist_details(id)
      
      # fetch Playlist song details with download links
      playlist_songs_details = api.get_playlist_song_download_links(id)
    • From Command Line

      python3 -m musicapy.saavn_api -h

      Command Line Output

      usage: __main__.py [-h] [-t] [-c] [-d] [-l LINK] [-aD] [-a] [-sS SEARCH_SONG_QUERY] [-sA SEARCH_ALBUM_QUERY] [-sa SEARCH_ALL_QUERY]
      
      options:
        -h, --help            show this help message and exit
        -t, --trending        get trending songs
        -c, --charts          get charts
        -d, --download        generate download links
        -l LINK, --link LINK  link of song or album
        -aD, --album-details  get album details from link
        -a, --album           get album download links
        -sS SEARCH_SONG_QUERY, --search-song SEARCH_SONG_QUERY
                              search song by name
        -sA SEARCH_ALBUM_QUERY, --search-album SEARCH_ALBUM_QUERY
                              search album by name
        -sa SEARCH_ALL_QUERY, --search-all SEARCH_ALL_QUERY
                          search album or song by name

License

MIT License

musicapy's People

Contributors

arsaboo avatar dependabot[bot] avatar dmdhrumilmistry avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

musicapy's Issues

Playlist services errors

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

Need a way to get album details using albumid (token)

So, I am trying to manually create an identifier using the albumid, but it is not working. See the code below:

link = "https://www.jiosaavn.com/album/tu-jhoothi-main-makkaar/Zk6,htMIngg_"`
identifier = jiosaavn.create_identifier(link, 'album')
print(identifier)
print(jiosaavn.get_album_details(identifier))

This produces the following output:

{'type': 'link', 'value': 'Zk6,htMIngg_'}
{'title': 'Tu Jhoothi Main Makkaar', 'name': 'Tu Jhoothi Main Makkaar', 'year': '2023', 'release_date': '2023-03-16', 'primary_artists': 'Pritam', 'primary_artists_id': '456323', 'albumid': '43600311', 'perma_url': 'https://www.jiosaavn.com/album/tu-jhoothi-main-makkaar/Zk6,htMIngg_', 'image': 'http://c.saavncdn.com/903/Tu-Jhoothi-Main-Makkaar-Hindi-2023-20230316165419-150x150.jpg', 'songs': [{'id': 'ESqTThi-', 'type': '', 'song': 'Tere Pyaar Mein', 'album': 'Tu Jhoothi Main Makkaar', 'year': '2023', 'music': 'Pritam', 'music_id': '456323', 'primary_artists': 'Pritam, Arijit Singh, Nikhita Gandhi, Amitabh Bhattacharya', 'primary_artists_id': '456323, 459320, 745460, 458681', 'featured_artists': '', 'featured_artists_id': '', 'singers': 'Pritam, Arijit Singh, Nikhita Gandhi, Amitabh Bhattacharya', 'starring': '', 'image': 'http://c.saavncdn.com/903/Tu-Jhoothi-Main-Makkaar-Hindi-2023-20230316165419-150x150.jpg', 'label': '', 'albumid': '43600311', 'language': 'hindi', 'origin': 'album', 'play_count': '5563883', 'is_ringtone_available': False, 'copyright_text': '℗ 2023 Super Cassettes Industries Private Limited', '320kbps': 'true', 'is_dolby_content': False, 'explicit_content': 0, 'has_lyrics': 'false', 'lyrics_snippet': '', 'encrypted_media_url': 'ID2ieOjCrwfgWvL5sXl4B1ImC5QfbsDygeJVTrKUhFJx5+h7xMaEgJS+oHt6HNmppklXa/mBOGyRmSy64Jrnzxw7tS9a8Gtq', 'encrypted_media_path': 'NMKyboFo/Fi0VFqJf5Q3Rw==', 'media_preview_url': 'https://preview.saavncdn.com/903/643f0dffc7bfbec39b93cf3c35c1f90d_96_p.mp4', 'perma_url': 'https://www.jiosaavn.com/song/tere-pyaar-mein/NTsaZSBYXh4', 'album_url': 'https://www.jiosaavn.com/album/tu-jhoothi-main-makkaar/Zk6,htMIngg_', 'duration': '266', 'rights': {'code': 1, 'reason': 'Pro Only', 'cacheable': True, 'delete_cached_object': False}, 'webp': True, 'disabled': 'true', 'disabled_text': 'Pro Only', 'starred': 'false', 'artistMap': {'Pritam': '456323', 'Arijit Singh': '459320', 'Nikhita Gandhi': '745460', 'Amitabh Bhattacharya': '458681'}, 'release_date': '2023-03-16', 'vcode': '010910091863721', 'vlink': 'https://jiotunepreview.jio.com/content/Converted/010910091819687.mp3', 'triller_available': False, 'label_url': '/label/-albums/6DLuXO3VoTo_'}, {'id': 'pvUfIxm9', 'type': '', 'song': 'Pyaar Hota Kayi Baar Hai', 'album': 'Tu Jhoothi Main Makkaar', 'year': '2023', 'music': 'Pritam', 'music_id': '456323', 'primary_artists': 'Pritam, Arijit Singh, Amitabh Bhattacharya, Charan', 'primary_artists_id': '456323, 459320, 458681, 460577', 'featured_artists': '', 'featured_artists_id': '', 'singers': 'Pritam, Arijit Singh, Amitabh Bhattacharya, Charan', 'starring': '', 'image': 'http://c.saavncdn.com/903/Tu-Jhoothi-Main-Makkaar-Hindi-2023-20230316165419-150x150.jpg', 'label': '', 'albumid': '43600311', 'language': 'hindi', 'origin': 'album', 'play_count': '3614661', 'is_ringtone_available': False, 'copyright_text': '℗ 2023 Super Cassettes Industries Private Limited', '320kbps': 'true', 'is_dolby_content': False, 'explicit_content': 0, 'has_lyrics': 'false', 'lyrics_snippet': '', 'encrypted_media_url': 'ID2ieOjCrwfgWvL5sXl4B1ImC5QfbsDym0wRjMYIVANgZUqsnGnspcEu0oXEEpxussGqIXK/CIrmkYZzSNMmxhw7tS9a8Gtq', 'encrypted_media_path': 'NMKyboFo/Fi0VFqJf5Q3Rw==', 'media_preview_url': 'https://preview.saavncdn.com/903/be34fee24a5177160ed52356406f7a67_96_p.mp4', 'perma_url': 'https://www.jiosaavn.com/song/pyaar-hota-kayi-baar-hai/AB4,Vz1IWgo', 'album_url': 'https://www.jiosaavn.com/album/tu-jhoothi-main-makkaar/Zk6,htMIngg_', 'duration': '216', 'rights': {'code': 1, 'reason': 'Pro Only', 'cacheable': True, 'delete_cached_object': False}, 'webp': True, 'disabled': 'true', 'disabled_text': 'Pro Only', 'starred': 'false', 'artistMap': {'Pritam': '456323', 'Arijit Singh': '459320', 'Amitabh Bhattacharya': '458681', 'Charan': '460577'}, 'release_date': '2023-03-16', 'vcode': '010910091870266', 'vlink': 'https://jiotunepreview.jio.com/content/Converted/010910091826883.mp3', 'triller_available': False, 'label_url': '/label/-albums/6DLuXO3VoTo_'}, {'id': 'sV2Cuese', 'type': '', 'song': 'O Bedardeya', 'album': 'Tu Jhoothi Main Makkaar', 'year': '2023', 'music': 'Pritam', 'music_id': '456323', 'primary_artists': 'Pritam, Arijit Singh, Amitabh Bhattacharya', 'primary_artists_id': '456323, 459320, 458681', 'featured_artists': '', 'featured_artists_id': '', 'singers': 'Pritam, Arijit Singh, Amitabh Bhattacharya', 'starring': '', 'image': 'http://c.saavncdn.com/903/Tu-Jhoothi-Main-Makkaar-Hindi-2023-20230316165419-150x150.jpg', 'label': '', 'albumid': '43600311', 'language': 'hindi', 'origin': 'album', 'play_count': '1760720', 'is_ringtone_available': False, 'copyright_text': '℗ 2023 Super Cassettes Industries Private Limited', '320kbps': 'true', 'is_dolby_content': False, 'explicit_content': 0, 'has_lyrics': 'false', 'lyrics_snippet': '', 'encrypted_media_url': 'ID2ieOjCrwfgWvL5sXl4B1ImC5QfbsDySdsy0kDT51DAJWpiDAOz969fnTwcRliLscYcRYLzozM1Yuc5xyHDZBw7tS9a8Gtq', 'encrypted_media_path': 'NMKyboFo/Fi0VFqJf5Q3Rw==', 'media_preview_url': 'https://preview.saavncdn.com/903/a036e9cb0914abaf15b3c95855f9c5c4_96_p.mp4', 'perma_url': 'https://www.jiosaavn.com/song/o-bedardeya/Az5ZcgFVRFY', 'album_url': 'https://www.jiosaavn.com/album/tu-jhoothi-main-makkaar/Zk6,htMIngg_', 'duration': '313', 'rights': {'code': 1, 'reason': 'Pro Only', 'cacheable': True, 'delete_cached_object': False}, 'webp': True, 'disabled': 'true', 'disabled_text': 'Pro Only', 'starred': 'false', 'artistMap': {'Pritam': '456323', 'Arijit Singh': '459320', 'Amitabh Bhattacharya': '458681'}, 'release_date': '2023-03-16', 'vcode': '010910091901333', 'vlink': 'https://jiotunepreview.jio.com/content/Converted/010910091858172.mp3', 'triller_available': False, 'label_url': '/label/-albums/6DLuXO3VoTo_'}, {'id': 'CAC123DR', 'type': '', 'song': 'Show Me The Thumka', 'album': 'Tu Jhoothi Main Makkaar', 'year': '2023', 'music': 'Pritam', 'music_id': '456323', 'primary_artists': 'Pritam, Amitabh Bhattacharya, Sunidhi Chauhan, Shashwat Singh', 'primary_artists_id': '456323, 458681, 455129, 909299', 'featured_artists': '', 'featured_artists_id': '', 'singers': 'Pritam, Amitabh Bhattacharya, Sunidhi Chauhan, Shashwat Singh', 'starring': '', 'image': 'http://c.saavncdn.com/903/Tu-Jhoothi-Main-Makkaar-Hindi-2023-20230316165419-150x150.jpg', 'label': '', 'albumid': '43600311', 'language': 'hindi', 'origin': 'album', 'play_count': '2612918', 'is_ringtone_available': False, 'copyright_text': '℗ 2023 Super Cassettes Industries Private Limited', '320kbps': 'true', 'is_dolby_content': False, 'explicit_content': 0, 'has_lyrics': 'false', 'lyrics_snippet': '', 'encrypted_media_url': 'ID2ieOjCrwfgWvL5sXl4B1ImC5QfbsDydCEutku7IIqk6jYUG9VFY3n/524YGuwGzDuOuoFmDseYYBD8ZKYBcxw7tS9a8Gtq', 'encrypted_media_path': 'NMKyboFo/Fi0VFqJf5Q3Rw==', 'media_preview_url': 'https://preview.saavncdn.com/903/b57a8d48e48051d1a281b2778ba3c9c7_96_p.mp4', 'perma_url': 'https://www.jiosaavn.com/song/show-me-the-thumka/MykoAEYDc2E', 'album_url': 'https://www.jiosaavn.com/album/tu-jhoothi-main-makkaar/Zk6,htMIngg_', 'duration': '236', 'rights': {'code': 1, 'reason': 'Pro Only', 'cacheable': True, 'delete_cached_object': False}, 'webp': True, 'disabled': 'true', 'disabled_text': 'Pro Only', 'starred': 'false', 'artistMap': {'Pritam': '456323', 'Amitabh Bhattacharya': '458681', 'Sunidhi Chauhan': '455129', 'Shashwat Singh': '909299'}, 'release_date': '2023-03-16', 'vcode': '010910091879246', 'vlink': 'https://jiotunepreview.jio.com/content/Converted/010910091835772.mp3', 'triller_available': False, 'label_url': '/label/-albums/6DLuXO3VoTo_'}, {'id': 'U_-LFOuj', 'type': '', 'song': 'Jaadui', 'album': 'Tu Jhoothi Main Makkaar', 'year': '2023', 'music': 'Pritam', 'music_id': '456323', 'primary_artists': 'Pritam, Jubin Nautiyal, Amitabh Bhattacharya', 'primary_artists_id': '456323, 881158, 458681', 'featured_artists': '', 'featured_artists_id': '', 'singers': 'Pritam, Jubin Nautiyal, Amitabh Bhattacharya', 'starring': '', 'image': 'http://c.saavncdn.com/903/Tu-Jhoothi-Main-Makkaar-Hindi-2023-20230316165419-150x150.jpg', 'label': '', 'albumid': '43600311', 'language': 'hindi', 'origin': 'album', 'play_count': '501141', 'is_ringtone_available': False, 'copyright_text': '℗ 2023 Super Cassettes Industries Private Limited', '320kbps': 'true', 'is_dolby_content': False, 'explicit_content': 0, 'has_lyrics': 'false', 'lyrics_snippet': '', 'encrypted_media_url': 'ID2ieOjCrwfgWvL5sXl4B1ImC5QfbsDypB3w8k1mfhX8yAi/1noofnuBWraN2m1qg1FcllwEllL5TTRAa1Ikxhw7tS9a8Gtq', 'encrypted_media_path': 'NMKyboFo/Fi0VFqJf5Q3Rw==', 'media_preview_url': 'https://preview.saavncdn.com/903/1fcf095000a9f3c6abe54ef2cf93a739_96_p.mp4', 'perma_url': 'https://www.jiosaavn.com/song/jaadui/JTdGfTJ-Qlk', 'album_url': 'https://www.jiosaavn.com/album/tu-jhoothi-main-makkaar/Zk6,htMIngg_', 'duration': '222', 'rights': {'code': 1, 'reason': 'Pro Only', 'cacheable': True, 'delete_cached_object': False}, 'webp': True, 'disabled': 'true', 'disabled_text': 'Pro Only', 'starred': 'false', 'artistMap': {'Pritam': '456323', 'Jubin Nautiyal': '881158', 'Amitabh Bhattacharya': '458681'}, 'release_date': '2023-03-16', 'vcode': '010910091901323', 'vlink': 'https://jiotunepreview.jio.com/content/Converted/010910091857824.mp3', 'triller_available': False, 'label_url': '/label/-albums/6DLuXO3VoTo_'}, {'id': 'PI_vT8xk', 'type': '', 'song': 'Maine Pi Rakhi Hai', 'album': 'Tu Jhoothi Main Makkaar', 'year': '2023', 'music': 'Pritam', 'music_id': '456323', 'primary_artists': 'Pritam, Shreya Ghoshal, Amitabh Bhattacharya, Divya Kumar', 'primary_artists_id': '456323, 455130, 458681, 473376', 'featured_artists': '', 'featured_artists_id': '', 'singers': 'Pritam, Shreya Ghoshal, Amitabh Bhattacharya, Divya Kumar', 'starring': '', 'image': 'http://c.saavncdn.com/903/Tu-Jhoothi-Main-Makkaar-Hindi-2023-20230316165419-150x150.jpg', 'label': '', 'albumid': '43600311', 'language': 'hindi', 'origin': 'album', 'play_count': '258514', 'is_ringtone_available': False, 'copyright_text': '℗ 2023 Super Cassettes Industries Private Limited', '320kbps': 'true', 'is_dolby_content': False, 'explicit_content': 0, 'has_lyrics': 'false', 'lyrics_snippet': '', 'encrypted_media_url': 'ID2ieOjCrwfgWvL5sXl4B1ImC5QfbsDywijcuhS9TokUZ88gexojE144Nn/R73NpjUDa0Ny+BNHTfWULjAZBGhw7tS9a8Gtq', 'encrypted_media_path': 'NMKyboFo/Fi0VFqJf5Q3Rw==', 'media_preview_url': 'https://preview.saavncdn.com/903/bd2aad4d1c5a9195213fe5caed891dd1_96_p.mp4', 'perma_url': 'https://www.jiosaavn.com/song/maine-pi-rakhi-hai/ICE0RyAIT1g', 'album_url': 'https://www.jiosaavn.com/album/tu-jhoothi-main-makkaar/Zk6,htMIngg_', 'duration': '247', 'rights': {'code': 1, 'reason': 'Pro Only', 'cacheable': True, 'delete_cached_object': False}, 'webp': True, 'disabled': 'true', 'disabled_text': 'Pro Only', 'starred': 'false', 'artistMap': {'Pritam': '456323', 'Shreya Ghoshal': '455130', 'Amitabh Bhattacharya': '458681', 'Divya Kumar': '473376'}, 'release_date': '2023-03-16', 'vcode': '010910091901338', 'vlink': 'https://jiotunepreview.jio.com/content/Converted/010910091858209.mp3', 'triller_available': False, 'label_url': '/label/-albums/6DLuXO3VoTo_'}], 'modules': {'reco': {'source': 'reco.getAlbumReco', 'position': 1, 'score': '', 'bucket': '', 'scroll_type': 'SS_Basic', 'title': 'You Might Like', 'subtitle': '', 'highlight': '', 'simpleHeader': False, 'noHeader': False, 'source_api': True, 'source_params': {'albumid': '43600311'}, 'view_more': [], 'is_JT_module': False}, 'currentlyTrending': {'source': 'content.getTrending', 'position': 2, 'score': '', 'bucket': '', 'scroll_type': 'SS_Basic', 'title': 'Currently Trending Albums', 'subtitle': '', 'highlight': '', 'simpleHeader': False, 'noHeader': False, 'source_api': True, 'source_params': {'entity_type': 'album', 'entity_language': None}, 'view_more': [], 'is_JT_module': False}, 'topAlbumsFromSameYear': {'source': 'search.topAlbumsoftheYear', 'position': 3, 'score': '', 'bucket': '', 'scroll_type': 'SS_Basic', 'title': 'Top Albums from Same Year', 'subtitle': '', 'highlight': '', 'simpleHeader': False, 'noHeader': False, 'source_api': True, 'source_params': {'album_year': '2023', 'album_lang': None}, 'view_more': [], 'is_JT_module': False}, 'artists': {'source': 'artists', 'position': 4, 'score': '', 'bucket': '', 'scroll_type': 'SS_Basic', 'title': 'Artists', 'subtitle': '', 'highlight': '', 'simpleHeader': False, 'noHeader': False, 'view_more': [], 'is_JT_module': False}}}

The albumid for the above album is 43600311

Now that we have albumid (which I am saving in my beets plugin), I was hoping that we can use this albumid to get the same information. I tried manually creating an identifier using:

id = {'type': 'ID', 'value': 43600311}
print(id)
print(jiosaavn.get_album_details(id))

The id looks fine and I tried different combinations, but none of them worked. I keep getting the error:

{'type': 'ID', 'value': '43600311'}
{'error': {'code': 'INPUT_MISSING', 'msg': 'One or more required field missing:albumid'}}

Basically, my question is how do we get album or song information using the albumid/songid that Saavn uses internally?

TypeError: 'str' object cannot be interpreted as an integer

I am using MusicAPy in a beets plugin and I am getting this error when searching for an album:

Traceback (most recent call last):
  File "/home/arsaboo/.local/bin/beet", line 8, in <module>
    sys.exit(main())
  File "/home/arsaboo/.local/lib/python3.10/site-packages/beets/ui/__init__.py", line 1301, in main
    _raw_main(args)
  File "/home/arsaboo/.local/lib/python3.10/site-packages/beets/ui/__init__.py", line 1288, in _raw_main
    subcommand.func(lib, suboptions, subargs)
  File "/home/arsaboo/.local/lib/python3.10/site-packages/beets/ui/commands.py", line 1034, in import_func
    import_files(lib, paths, query)
  File "/home/arsaboo/.local/lib/python3.10/site-packages/beets/ui/commands.py", line 974, in import_files
    session.run()
  File "/home/arsaboo/.local/lib/python3.10/site-packages/beets/importer.py", line 345, in run
    pl.run_parallel(QUEUE_SIZE)
  File "/home/arsaboo/.local/lib/python3.10/site-packages/beets/util/pipeline.py", line 446, in run_parallel
    raise exc_info[1].with_traceback(exc_info[2])
  File "/home/arsaboo/.local/lib/python3.10/site-packages/beets/util/pipeline.py", line 311, in run
    out = self.coro.send(msg)
  File "/home/arsaboo/.local/lib/python3.10/site-packages/beets/util/pipeline.py", line 170, in coro
    task = func(*(args + (task,)))
  File "/home/arsaboo/.local/lib/python3.10/site-packages/beets/importer.py", line 1460, in user_query
    task.choose_match(session)
  File "/home/arsaboo/.local/lib/python3.10/site-packages/beets/importer.py", line 896, in choose_match
    choice = session.choose_match(self)
  File "/home/arsaboo/.local/lib/python3.10/site-packages/beets/ui/commands.py", line 780, in choose_match
    post_choice = choice.callback(self, task)
  File "/home/arsaboo/.local/lib/python3.10/site-packages/beets/ui/commands.py", line 710, in manual_id
    _, _, prop = autotag.tag_album(
  File "/home/arsaboo/.local/lib/python3.10/site-packages/beets/autotag/match.py", line 473, in tag_album
    for album_info_for_id in hooks.albums_for_id(search_id):
  File "/home/arsaboo/.local/lib/python3.10/site-packages/beets/autotag/hooks.py", line 652, in albums_for_id
    for a in plugins.album_for_id(album_id):
  File "/home/arsaboo/.local/lib/python3.10/site-packages/beets/plugins.py", line 399, in album_for_id
    album = plugin.album_for_id(album_id)
  File "/home/arsaboo/.local/lib/python3.10/site-packages/beetsplug/jiosaavn.py", line 220, in album_for_id
    album_details = self.jiosaavn.get_album_details(id)
  File "/home/arsaboo/.local/lib/python3.10/site-packages/musicapy/saavn_api/services.py", line 269, in get_album_details
    song_details = SongService.get_song_details(song_identifier, use_v4=False)
  File "/home/arsaboo/.local/lib/python3.10/site-packages/musicapy/saavn_api/services.py", line 87, in get_song_details
    song_details = get_data(api_type, param, use_v4)
  File "/home/arsaboo/.local/lib/python3.10/site-packages/musicapy/saavn_api/endpoint.py", line 41, in get_data
    data.pop('modules')
TypeError: 'str' object cannot be interpreted as an integer

You can reproduce the error using the following code:

from musicapy.saavn_api.api import SaavnAPI

# create API obj
api = SaavnAPI()

saavn_song_link = 'https://www.jiosaavn.com/album/high-jack/v-,5W1NUOFU_'
identifier = api.create_identifier(saavn_song_link, 'album')
api.get_album_details(identifier)

duplicate results!!!

hello there!!!congratulations for your amazing project!but please could you remove alla duplicate results?it would be great!!!

Define complex query

Wondering if is it possible to add other parameters in the search API. For example, I would like to add album, year, and title to get the right matches in api.search_song('song_name').

help please!!!

my good friend Before uninstall python tomorrow morning I could download with python from spotyfy spotdl!but now I cant my friend!please can you tell me the correct commands on cmd to run pip3 and python???please dude help me!!!

C:\Users\User>pip3 install
Defaulting to user installation because normal site-packages is not writeable
ERROR: You must give at least one requirement to install (see "pip help install")
WARNING: You are using pip version 22.0.4; however, version 22.1 is available.
You should consider upgrading via the 'C:\Program Files\Python39\python.exe -m pip install --upgrade pip' command.

Get playlist songs

Can we also add the ability to get playlist songs? Users can provide the playlist url.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.