From 98d2de29d5ef4dd677851493a1210ee12c40ba43 Mon Sep 17 00:00:00 2001 From: vidya sagar Date: Sat, 11 Dec 2021 17:18:15 +0530 Subject: [PATCH 1/3] added JioSaavn class --- JioSaavn/Async.py | 15 + JioSaavn/__asyncJioSaavn.py | 510 +++++++++++++++++++ JioSaavn/__asyncparseResponse.py | 92 ++++ JioSaavn/{_helper.py => __asyncrequests.py} | 32 +- JioSaavn/{_baseApiUrl.py => __baseApiUrl.py} | 0 JioSaavn/__constants.py | 8 + JioSaavn/{_exceptions.py => __exceptions.py} | 4 +- JioSaavn/__helper.py | 17 + JioSaavn/__init__.py | 19 +- JioSaavn/__syncrequests.py | 40 ++ JioSaavn/{_useragent.py => __useragent.py} | 2 + JioSaavn/{_validation.py => __validation.py} | 0 JioSaavn/{_fetch.py => _asyncFetch.py} | 130 +++-- JioSaavn/_parseResponse.py | 99 ---- JioSaavn/_requests.py | 20 - setup.py | 4 +- test.py | 23 + 17 files changed, 843 insertions(+), 172 deletions(-) create mode 100644 JioSaavn/Async.py create mode 100644 JioSaavn/__asyncJioSaavn.py create mode 100644 JioSaavn/__asyncparseResponse.py rename JioSaavn/{_helper.py => __asyncrequests.py} (55%) rename JioSaavn/{_baseApiUrl.py => __baseApiUrl.py} (100%) create mode 100644 JioSaavn/__constants.py rename JioSaavn/{_exceptions.py => __exceptions.py} (97%) create mode 100644 JioSaavn/__helper.py create mode 100644 JioSaavn/__syncrequests.py rename JioSaavn/{_useragent.py => __useragent.py} (99%) rename JioSaavn/{_validation.py => __validation.py} (100%) rename JioSaavn/{_fetch.py => _asyncFetch.py} (86%) delete mode 100644 JioSaavn/_parseResponse.py delete mode 100644 JioSaavn/_requests.py create mode 100644 test.py diff --git a/JioSaavn/Async.py b/JioSaavn/Async.py new file mode 100644 index 0000000..b6c79b3 --- /dev/null +++ b/JioSaavn/Async.py @@ -0,0 +1,15 @@ +from .__asyncJioSaavn import JioSaavn +# from .__internal._async._fetch import * + +from ._asyncFetch import searchSong,searchAlbum,song,album,playlist,lyrics + + +__all__ =[ + 'JioSaavn', + 'searchSong', + 'searchAlbum', + 'song', + 'album', + 'playlist', + 'lyrics' +] diff --git a/JioSaavn/__asyncJioSaavn.py b/JioSaavn/__asyncJioSaavn.py new file mode 100644 index 0000000..5bdebac --- /dev/null +++ b/JioSaavn/__asyncJioSaavn.py @@ -0,0 +1,510 @@ + +from typing import Optional +from . import _asyncFetch + +class JioSaavn: + + @staticmethod + async def searchSong(query:str,page:int=1,limit:int=10,response:str='json'): + '''Searches for song in JioSaavn. + + Args: + query (str): Sets the search query. + page (int, optional): Sets page to the number of page. Defaults to 1. + limit (int, optional): Sets limit to the number of results. Defaults to 10. Max to 30. + response(str,optional): Sets the response of result. Defaults to `json`. + + Note: + To get raw result Set `response` to `raw` + + Example: + Calling `searchSong` method gives the search result of songs. + >>> from JioSaavn.Async import jiosaavn + >>> search = await jiosaavn.searchSong('alone') + >>> print(search) + [ + { + "id": "HgyjuLNF", + "title": "Alone Alone (From "Malli Modalaindi")", + "image": "https://c.saavncdn.com/156/Alone-Alone-From-Malli-Modalaindi--Telugu-2021-20210920131019-150x150.jpg", + "images": { + "50x50": "https://c.saavncdn.com/156/Alone-Alone-From-Malli-Modalaindi--Telugu-2021-20210920131019-50x50.jpg", + "150x150": "https://c.saavncdn.com/156/Alone-Alone-From-Malli-Modalaindi--Telugu-2021-20210920131019-150x150.jpg", + "500x500": "https://c.saavncdn.com/156/Alone-Alone-From-Malli-Modalaindi--Telugu-2021-20210920131019-500x500.jpg" + }, + "album": "Alone Alone (From "Malli Modalaindi")", + "description": "Alone Alone (From "Malli Modalaindi") - Sid Sriram, Anup Rubens", + "has_lyrics": "false", + "singers": [ + "Sid Sriram", + "Anup Rubens" + ], + "language": "Telugu", + "album_id": "29782034", + "url": { + "song": "https://www.jiosaavn.com/song/alone-alone-from-malli-modalaindi/OA8SWwF8eXU", + "album": "https://www.jiosaavn.com/album/alone-alone-from-malli-modalaindi/lLQ4oVnaTvM_" + }, + }, + { + "id": "veJXEDAz", + "title": "Alone", + "image": "https://c.saavncdn.com/743/Alone-Punjabi-2020-20200507184621-150x150.jpg", + "images": { + "50x50": "https://c.saavncdn.com/743/Alone-Punjabi-2020-20200507184621-50x50.jpg", + "150x150": "https://c.saavncdn.com/743/Alone-Punjabi-2020-20200507184621-150x150.jpg", + "500x500": "https://c.saavncdn.com/743/Alone-Punjabi-2020-20200507184621-500x500.jpg" + }, + "album": "Alone", + "description": "Alone - Raashi Sood", + "has_lyrics": "false", + "singers": [ + "Raashi Sood" + ], + "language": "Punjabi", + "album_id": "20256407", + "url": { + "song": "https://www.jiosaavn.com/song/alone/Bg0haTF0dkk", + "album": "https://www.jiosaavn.com/album/alone/,kQ0LrBIybc_" + }, + } + ] + ''' + return await _asyncFetch.searchSong(query=query,page=page,limit=limit,response=response) + + @staticmethod + async def searchAlbum(query:str,response:str='json'): + '''Searches for album in JioSaavn. + + Args: + query (str): Sets the search query. + response(str,optional): Sets the response of result. Defaults to `json`. + + Note: + To get raw result Set `response` to `raw` + + Examples: + Calling `searchAlbum` method gives the search result of albums. + >>> from JioSaavn.Async import jiosaavn + >>> search = await jiosaavn.searchAlbum('Alone') + >>> print(search) + [ + { + "id": "29782034", + "title": "Alone Alone (From "Malli Modalaindi")", + "image": "https://c.saavncdn.com/156/Alone-Alone-From-Malli-Modalaindi--Telugu-2021-20210920131019-150x150.jpg", + "images": { + "50x50": "https://c.saavncdn.com/156/Alone-Alone-From-Malli-Modalaindi--Telugu-2021-20210920131019-50x50.jpg", + "150x150": "https://c.saavncdn.com/156/Alone-Alone-From-Malli-Modalaindi--Telugu-2021-20210920131019-150x150.jpg", + "500x500": "https://c.saavncdn.com/156/Alone-Alone-From-Malli-Modalaindi--Telugu-2021-20210920131019-500x500.jpg" + }, + "music": "Sid Sriram, Anup Rubens", + "description": "2021 · Telugu Album · Sid Sriram, Anup Rubens", + "year": "2021", + "language": "Telugu", + "url": "https://www.jiosaavn.com/album/alone-alone-from-malli-modalaindi/lLQ4oVnaTvM_", + "song": "HgyjuLNF", + }, + { + "id": "1215558", + "title": "Alone", + "image": "https://c.saavncdn.com/794/Alone-Hindi-2014-150x150.jpg", + "images": { + "50x50": "https://c.saavncdn.com/794/Alone-Hindi-2014-50x50.jpg", + "150x150": "https://c.saavncdn.com/794/Alone-Hindi-2014-150x150.jpg", + "500x500": "https://c.saavncdn.com/794/Alone-Hindi-2014-500x500.jpg" + }, + "music": "Ankit Tiwari", + "description": "2014 · Hindi Film · Ankit Tiwari", + "year": "2014", + "language": "Hindi", + "url": "https://www.jiosaavn.com/album/alone/MmI5C7Qd8xU_", + "song": "woZT1XKb, BW3ZjaVE, 30LGCvEo, IVnaw30E", + }, + ] + ''' + return await _asyncFetch.searchAlbum(query=query,response=response) + + @staticmethod + async def song(url:Optional[str]=None,id:Optional[str]=None,lyrics:bool=False,response:str='json'): + '''Get song info from JioSaavn. + + Args: + url (str): Sets the url of song. + id (str): Sets the id of song. + lyrics (bool): Sets the lyrics whether to get lyrics. Defaults to `False`. + response(str,optional): Sets the response of result. Defaults to `json`. + + Note: + To get raw result Set `response` to `raw` + + Examples: + Calling `song` method gives the song info. + >>> from JioSaavn.Async import jiosaavn + >>> result = await jiosaavn.song(id='veJXEDAz') + >>> print(result) + { + "id": "veJXEDAz", + "song": "Alone", + "album": "Alone", + "year": "2020", + "primary_artists": [ + "Raashi Sood" + ], + "singers": [ + "Raashi Sood" + ], + "image": "https://c.saavncdn.com/743/Alone-Punjabi-2020-20200507184621-500x500.jpg", + "images": { + "50x50": "https://c.saavncdn.com/743/Alone-Punjabi-2020-20200507184621-50x50.jpg", + "150x150": "https://c.saavncdn.com/743/Alone-Punjabi-2020-20200507184621-150x150.jpg", + "500x500": "https://c.saavncdn.com/743/Alone-Punjabi-2020-20200507184621-500x500.jpg" + }, + "duration": "120", + "label": "Raashi Sood Music", + "albumid": "20256407", + "language": "Punjabi", + "copyright_text": "© 2020 Raashi Sood Music", + "has_lyrics": "false", + "lyrics": null, + "media_url": "https://aac.saavncdn.com/743/dc78d52426dff2c0bf8e755c4721c398_160.mp4", + "media_urls": { + "96_KBPS": "https://aac.saavncdn.com/743/dc78d52426dff2c0bf8e755c4721c398_96.mp4", + "160_KBPS": "https://aac.saavncdn.com/743/dc78d52426dff2c0bf8e755c4721c398_160.mp4", + "320_KBPS": "https://aac.saavncdn.com/743/dc78d52426dff2c0bf8e755c4721c398_320.mp4" + }, + "release_date": "2020-05-07", + "url": { + "song": "https://www.jiosaavn.com/song/alone/Bg0haTF0dkk", + "album": "https://www.jiosaavn.com/album/alone/,kQ0LrBIybc_" + }, + } + ''' + return await _asyncFetch.song(url=url,id=id,lyrics=lyrics,response=response) + + @staticmethod + async def album(url:Optional[str]=None,id:Optional[str]=None,lyrics:bool=False,response:str='json'): + '''Get album info from JioSaavn. + + Args: + url (str): Sets the url of album. + id (str): Sets the id of album. + lyrics (bool): Sets the lyrics whether to get lyrics. Defaults to `False`. + response(str,optional): Sets the response of result. Defaults to `json`. + + Note: + To get raw result Set `response` to `raw` + + Examples: + Calling `album` method gives the album info. + >>> from JioSaavn.Async import jiosaavn + >>> result = await jiosaavn.album(id='10496527') + >>> print(result) + { + "albumid": "10496527", + "title": "Baahubali 2 - The Conclusion", + "name": "Baahubali 2 - The Conclusion", + "year": "2017", + "primary_artists": [ + "M. M. Keeravani" + ], + "image": "https://c.saavncdn.com/271/Baahubali-2-The-Conclusion-Telugu-2017-150x150.jpg", + "songs": [ + { + "id": "blMuXL1P", + "song": "Saahore Baahubali", + "album": "Baahubali 2 - The Conclusion", + "year": "2017", + "primary_artists": [ + "Daler Mehndi", + "M. M. Keeravani", + "Mounima Ch" + ], + "singers": [ + "Daler Mehndi", + "M. M. Keeravani", + "Mounima Ch" + ], + "image": "https://c.saavncdn.com/271/Baahubali-2-The-Conclusion-Telugu-2017-500x500.jpg", + "images": { + "50x50": "https://c.saavncdn.com/271/Baahubali-2-The-Conclusion-Telugu-2017-50x50.jpg", + "150x150": "https://c.saavncdn.com/271/Baahubali-2-The-Conclusion-Telugu-2017-150x150.jpg", + "500x500": "https://c.saavncdn.com/271/Baahubali-2-The-Conclusion-Telugu-2017-500x500.jpg" + }, + "duration": "203", + "label": "Lahari Music", + "albumid": "10496527", + "language": "Telugu", + "copyright_text": "© 2017 Lahari Music", + "has_lyrics": "true", + "lyrics": null, + "media_url": "https://aac.saavncdn.com/271/22dda6f74d38544c0b0d27d65ddddac1_160.mp4", + "media_urls": { + "96_KBPS": "https://aac.saavncdn.com/271/22dda6f74d38544c0b0d27d65ddddac1_96.mp4", + "160_KBPS": "https://aac.saavncdn.com/271/22dda6f74d38544c0b0d27d65ddddac1_160.mp4", + "320_KBPS": "https://aac.saavncdn.com/271/22dda6f74d38544c0b0d27d65ddddac1_320.mp4" + }, + "release_date": "2017-03-26", + "url": { + "song": "https://www.jiosaavn.com/song/saahore-baahubali/EgQmRCx8BmM", + "album": "https://www.jiosaavn.com/album/baahubali-2---the-conclusion/Vm5jaOSkM7E_" + }, + }, + { + "id": "XvwEmXL_", + "song": "Hamsa Naava", + "album": "Baahubali 2 - The Conclusion", + "year": "2017", + "primary_artists": [ + "Sony", + "Deepu" + ], + "singers": [ + "Sony", + "Deepu" + ], + "image": "https://c.saavncdn.com/271/Baahubali-2-The-Conclusion-Telugu-2017-500x500.jpg", + "images": { + "50x50": "https://c.saavncdn.com/271/Baahubali-2-The-Conclusion-Telugu-2017-50x50.jpg", + "150x150": "https://c.saavncdn.com/271/Baahubali-2-The-Conclusion-Telugu-2017-150x150.jpg", + "500x500": "https://c.saavncdn.com/271/Baahubali-2-The-Conclusion-Telugu-2017-500x500.jpg" + }, + "duration": "204", + "label": "Lahari Music", + "albumid": "10496527", + "language": "Telugu", + "copyright_text": "© 2017 Lahari Music", + "has_lyrics": "true", + "lyrics": null, + "media_url": "https://aac.saavncdn.com/271/5d651eeaa54b93af16a7c39999615f2d_160.mp4", + "media_urls": { + "96_KBPS": "https://aac.saavncdn.com/271/5d651eeaa54b93af16a7c39999615f2d_96.mp4", + "160_KBPS": "https://aac.saavncdn.com/271/5d651eeaa54b93af16a7c39999615f2d_160.mp4", + "320_KBPS": "https://aac.saavncdn.com/271/5d651eeaa54b93af16a7c39999615f2d_320.mp4" + }, + "release_date": "2017-03-26", + "url": { + "song": "https://www.jiosaavn.com/song/hamsa-naava/KB4cdBloe2w", + "album": "https://www.jiosaavn.com/album/baahubali-2---the-conclusion/Vm5jaOSkM7E_" + }, + }, + { + "id": "M3D7qn6T", + "song": "Kannaa Nidurinchara", + "album": "Baahubali 2 - The Conclusion", + "year": "2017", + "primary_artists": [ + "Sreenidhi Tirumala", + "V. Srisoumya" + ], + "singers": [ + "Sreenidhi Tirumala", + "V. Srisoumya" + ], + "image": "https://c.saavncdn.com/271/Baahubali-2-The-Conclusion-Telugu-2017-500x500.jpg", + "images": { + "50x50": "https://c.saavncdn.com/271/Baahubali-2-The-Conclusion-Telugu-2017-50x50.jpg", + "150x150": "https://c.saavncdn.com/271/Baahubali-2-The-Conclusion-Telugu-2017-150x150.jpg", + "500x500": "https://c.saavncdn.com/271/Baahubali-2-The-Conclusion-Telugu-2017-500x500.jpg" + }, + "duration": "291", + "label": "Lahari Music", + "albumid": "10496527", + "language": "Telugu", + "copyright_text": "© 2017 Lahari Music", + "has_lyrics": "true", + "lyrics": null, + "media_url": "https://aac.saavncdn.com/271/5e4fe5350641ff6c285d79676a483222_160.mp4", + "media_urls": { + "96_KBPS": "https://aac.saavncdn.com/271/5e4fe5350641ff6c285d79676a483222_96.mp4", + "160_KBPS": "https://aac.saavncdn.com/271/5e4fe5350641ff6c285d79676a483222_160.mp4", + "320_KBPS": "https://aac.saavncdn.com/271/5e4fe5350641ff6c285d79676a483222_320.mp4" + }, + "release_date": "2017-03-26", + "url": { + "song": "https://www.jiosaavn.com/song/kannaa-nidurinchara/PVsvBgVeAWc", + "album": "https://www.jiosaavn.com/album/baahubali-2---the-conclusion/Vm5jaOSkM7E_" + }, + }, + ], + "perma_url": "https://www.jiosaavn.com/album/baahubali-2---the-conclusion/Vm5jaOSkM7E_", + "release_date": "2017-03-26" + } + ''' + return await _asyncFetch.album(url=url,id=id,lyrics=lyrics,response=response) + + @staticmethod + async def playlist(url:Optional[str]=None,id:Optional[str]=None,lyrics:bool=False,response:str='json'): + '''Get playlist info from JioSaavn. + + Args: + url (str): Sets the url of playlist. + id (str): Sets the id of playlist. + lyrics (bool): Sets the lyrics whether to get lyrics. Defaults to `False`. + response(str,optional): Sets the response of result. Defaults to `json`. + + Note: + To get raw result Set `response` to `raw` + + Examples: + Calling `playlist` method gives the playlist info. + >>> from JioSaavn.Async import jiosaavn + >>> result = await jiosaavn.playlist(url='https://www.jiosaavn.com/s/playlist/88063878238ad9a391a33c0e628d2b01/90s_Love/OykxHSA0YytFo9wdEAzFBA__') + >>> print(result) + { + "listid": "268477478", + "title": "90's Love", + "username": "", + "list_count": "17", + "uid": "88063878238ad9a391a33c0e628d2b01", + "perma_url": "https://www.jiosaavn.com/s/playlist/88063878238ad9a391a33c0e628d2b01/90s_Love/OykxHSA0YytFo9wdEAzFBA__", + "image": "https://pli.saavncdn.com/74/78/268477478.jpg?bch=1555760417", + "songs": [ + { + "id": "2XLkr2Gd", + "song": "Kal Ho Naa Ho", + "album": "Kal Ho Naa Ho (Original Motion Picture Soundtrack)", + "year": "2003", + "primary_artists": [ + "Shankar-Ehsaan-Loy", + "Sonu Nigam" + ], + "singers": [ + "Shankar-Ehsaan-Loy", + "Sonu Nigam" + ], + "image": "https://c.saavncdn.com/909/Kal-Ho-Naa-Ho-Hindi-2003-500x500.jpg", + "images": { + "50x50": "https://c.saavncdn.com/909/Kal-Ho-Naa-Ho-Hindi-2003-50x50.jpg", + "150x150": "https://c.saavncdn.com/909/Kal-Ho-Naa-Ho-Hindi-2003-150x150.jpg", + "500x500": "https://c.saavncdn.com/909/Kal-Ho-Naa-Ho-Hindi-2003-500x500.jpg" + }, + "duration": "321", + "label": "Sony Music Entertainment India Pvt. Ltd.", + "albumid": "1208084", + "language": "Hindi", + "copyright_text": "(P) 2003 Sony Music Entertainment India Pvt. Ltd.", + "has_lyrics": "false", + "lyrics": null, + "media_url": "https://aac.saavncdn.com/909/b34c95486eb42ede300a549da19a38ad_160.mp4", + "media_urls": { + "96_KBPS": "https://aac.saavncdn.com/909/b34c95486eb42ede300a549da19a38ad_96.mp4", + "160_KBPS": "https://aac.saavncdn.com/909/b34c95486eb42ede300a549da19a38ad_160.mp4", + "320_KBPS": "https://aac.saavncdn.com/909/b34c95486eb42ede300a549da19a38ad_320.mp4" + }, + "release_date": "2003-09-20", + "url": { + "song": "https://www.jiosaavn.com/song/kal-ho-naa-ho/QjAnWgYCcFc", + "album": "https://www.jiosaavn.com/album/kal-ho-naa-ho-original-motion-picture-soundtrack/wxleSiR74Dg_" + } + }, + { + "id": "lULDgPcz", + "song": "Main Hoon Na", + "album": "Main Hoon Na", + "year": "2004", + "primary_artists": [ + "Sonu Nigam", + "Shreya Ghoshal" + ], + "singers": [ + "Sonu Nigam", + "Shreya Ghoshal" + ], + "image": "https://c.saavncdn.com/388/Main-Hoon-Na-Hindi-2004-500x500.jpg", + "images": { + "50x50": "https://c.saavncdn.com/388/Main-Hoon-Na-Hindi-2004-50x50.jpg", + "150x150": "https://c.saavncdn.com/388/Main-Hoon-Na-Hindi-2004-150x150.jpg", + "500x500": "https://c.saavncdn.com/388/Main-Hoon-Na-Hindi-2004-500x500.jpg" + }, + "duration": "361", + "label": "", + "albumid": "1037222", + "language": "Hindi", + "copyright_text": "© 2004 ", + "has_lyrics": "true", + "lyrics": null, + "media_url": "https://aac.saavncdn.com/388/348841a9282b5b362526a8098a7f4491_160.mp4", + "media_urls": { + "96_KBPS": "https://aac.saavncdn.com/388/348841a9282b5b362526a8098a7f4491_96.mp4", + "160_KBPS": "https://aac.saavncdn.com/388/348841a9282b5b362526a8098a7f4491_160.mp4", + "320_KBPS": "https://aac.saavncdn.com/388/348841a9282b5b362526a8098a7f4491_320.mp4" + }, + "release_date": "2004-02-27", + "url": { + "song": "https://www.jiosaavn.com/song/main-hoon-na/HD0ndRNgVEk", + "album": "https://www.jiosaavn.com/album/main-hoon-na/Gf2uDkAyAkg_" + } + }, + { + "id": "jFerJMnc", + "song": "Koi Mil Gaya", + "album": "Kuch Kuch Hota Hai (Original Motion Picture Soundtrack)", + "year": "1998", + "primary_artists": [ + "Jatin-Lalit", + "Kavita Krishnamurthy", + "Udit Narayan", + "Alka Yagnik" + ], + "singers": [ + "Jatin-Lalit", + "Kavita Krishnamurthy", + "Udit Narayan", + "Alka Yagnik" + ], + "image": "https://c.saavncdn.com/907/Kuch-Kuch-Hota-Hai-Hindi-1998-20190516130035-500x500.jpg", + "images": { + "50x50": "https://c.saavncdn.com/907/Kuch-Kuch-Hota-Hai-Hindi-1998-20190516130035-50x50.jpg", + "150x150": "https://c.saavncdn.com/907/Kuch-Kuch-Hota-Hai-Hindi-1998-20190516130035-150x150.jpg", + "500x500": "https://c.saavncdn.com/907/Kuch-Kuch-Hota-Hai-Hindi-1998-20190516130035-500x500.jpg" + }, + "duration": "437", + "label": "Sony Music Entertainment India Pvt. Ltd.", + "albumid": "1035265", + "language": "Hindi", + "copyright_text": "(P) 1998 Sony Music Entertainment India Pvt. Ltd.", + "has_lyrics": "false", + "lyrics": null, + "media_url": "https://aac.saavncdn.com/907/2d22f49ec5435c9d606742ae2648a5a2_160.mp4", + "media_urls": { + "96_KBPS": "https://aac.saavncdn.com/907/2d22f49ec5435c9d606742ae2648a5a2_96.mp4", + "160_KBPS": "https://aac.saavncdn.com/907/2d22f49ec5435c9d606742ae2648a5a2_160.mp4", + "320_KBPS": "https://aac.saavncdn.com/907/2d22f49ec5435c9d606742ae2648a5a2_320.mp4" + }, + "release_date": "1998-08-19", + "url": { + "song": "https://www.jiosaavn.com/song/koi-mil-gaya/Gi4OQz59WVA", + "album": "https://www.jiosaavn.com/album/kuch-kuch-hota-hai-original-motion-picture-soundtrack/zvqnBMKjQeM_" + } + }, + ] + } + ''' + return await _asyncFetch.playlist(url=url,id=id,lyrics=lyrics,response=response) + + @staticmethod + async def lyrics(url:Optional[str]=None,id:Optional[str]=None,response:str='json'): + '''Get lyrics of a song (If Available) + + Args: + url (str): Sets the url of playlist. + id (str): Sets the id of song. + response(str,optional): Sets the response of result. Defaults to `json`. + + Note: + To get raw result Set `response` to `raw` + + Examples: + Calling `lyrics` method gives the lyrics of song. + >>> from JioSaavn.Async import jiosaavn + >>> result = await jiosaavn.lyrics(id='blMuXL1P') + >>> print(result) + { + "lyrics": "bhali bhali bhalira bhali
sahore bahubali
bhali bhali bhalira bhali
sahore bahubali
jayaarti nike pattali pattali
bhuvanalanni jai kottali
gaganale chhatra pattali

haiss rudrass haisarbhadra samudrass
haiss rudrass haisarbhadra samudrass
haiss rudrass haisarbhadra samudrass
haiss rudrass haisarbhadra samudrass

aa janani deeksha achalam
i koduke kavachan
ippuda ammaki amm ainanduka
pulkarinchindiga i kshana

aduulu guttal mittal gaminch
pidikit pidugul patti minch
arikul vargal durgal jayinch
avaniki swarganne dinch

ant maha baludina amm ori pasiwade
shivudaina bhavudaina ammaku sat kadantade

haiss rudrass haisarbhadra samudrass
haiss rudrass haisarbhadra samudrass
haiss rudrass haiss rudrass
haisarbhadra samudrass haisarbhadra samudrass
haiss rudrass haisarbhadra samudrass
haiss rudrass haisarbhadra samudrass
haiss rudrass haisarbhadra samudrass
haiss rudrass haisarbhadra samudrass
haiss rudrass haisarbhadra samudrass

bhali bhali bhalira bhali
sahore bahubali
jayaarti nike pattali
bhali bhali bhalira bhali
sahore bahubali
jayaarti nike pattali pattali
bhuvanalanni jai kottali
gaganale chhatra pattali", + "lyrics_copyright": "Writer(s): M. M. Keeravaani, Shiva Shakthi Datta, K. Ramakrishna Lyrics powered by www.musixmatch.com", + "snippet": "haiss rudrass haisarbhadra samudrass" + } + ''' + return await _asyncFetch.lyrics(url=url,id=id,response=response) + diff --git a/JioSaavn/__asyncparseResponse.py b/JioSaavn/__asyncparseResponse.py new file mode 100644 index 0000000..4402b63 --- /dev/null +++ b/JioSaavn/__asyncparseResponse.py @@ -0,0 +1,92 @@ + +import re +from . import __helper +from . import _asyncFetch + +async def makeSongResponse(song,lyrics:bool=False): + return { + 'id': song['id'], + 'songName':song['song'], + 'albumName':song['album'], + 'albumId': song['albumid'], + 'playCount': song['play_count'], + 'duration': song['duration'], + 'label': song['label'], + 'primaryArtists': song['primary_artists'], + 'primaryArtistsId':song['primary_artists_id'], + 'featuredArtists': song['featured_artists'], + 'featuredArtistsId':song['featured_artists_id'], + # 'primaryArtists': [{'artist':artist,'id':id} for artist,id in zip((song['primary_artists']).split(', '),(song['primary_artists_id']).split(', '))], + # 'featuredArtists': [{'artist':artist,'id':id} for artist,id in zip((song['featured_artists']).split(', '),(song['featured_artists_id']).split(', '))], + 'singers': song['singers'], + 'starring':song['starring'], + 'language': __helper.ucfirst(song['language']), + 'copyright': song['copyright_text'], + 'hasLyrics' : song['has_lyrics'], + 'lyrics': await _asyncFetch.lyrics(song['id']) if song['has_lyrics'] == "true" and lyrics else None, + 'releaseDate': song['release_date'], + 'songUrl':song['perma_url'], + 'albumUrl': song['album_url'], + 'imagesUrls': __helper.makeDifferentQualityImages(song['image']), + 'audioUrls':__helper.makeDifferentQualityMediaUrls(song['media_preview_url']), + 'labelUrl':f"https://www.jiosaavn.com{song['label_url']}", + } + + +async def makeSearchResponse(data): + return [{ + 'id':i['id'], + 'songName':i['title'], + 'albumId':i['more_info']['album_id'], + 'albumName':i['more_info']['album'], + 'playCount': i['play_count'], + 'imagesUrls':__helper.makeDifferentQualityImages(i['image']), + 'primaryArtists':i['more_info']['artistMap']['primary_artists'], + 'featuredArtists':i['more_info']['artistMap']['featured_artists'], + 'artists':i['more_info']['artistMap']['artists'], + 'description':i['header_desc'], + 'hasLyrics':i['more_info']['has_lyrics'], + 'language':__helper.ucfirst(i['language']), + 'songUrl':i['perma_url'], + 'albumUrl':i['more_info']['album_url'], + 'labelUrl':f"https://www.jiosaavn.com{i['label_url']}", + } for i in data['results']] + + + +async def makeAlbumSearchResponse(data): + return [{ + 'id': i['id'], + 'albumName': i['title'], + 'music': i['music'], + 'description': i['description'], + 'year': i['more_info']['year'], + 'language': __helper.ucfirst(i['more_info']['language']), + 'songIds':i['more_info']['song_pids'], + 'albumUrl': i['url'], + 'imagesUrls':__helper.makeDifferentQualityImages(i['image']), + }for i in data['albums']['data']] + +async def makeAlbumResponse(data,lyrics:bool=False): + return { + 'albumId': data['albumid'], + 'title': data['title'], + 'name': data['name'], + 'year': data['year'], + 'primaryArtists': (data['primary_artists']).split(', '), + 'image': data['image'], + 'songs':[await makeSongResponse(song=song,lyrics=lyrics) for song in data['songs']], + 'songUrl': data['perma_url'], + 'releaseDate': data['release_date'], + } + +async def makePlaylistResponse(data,lyrics:bool=False): + return { + 'id': data['listid'], + 'listname': data['listname'], + 'username': data['username'], + 'listCount': data['list_count'], + 'playlistUrl': data['perma_url'], + 'image': data['image'], + 'songs':[await makeSongResponse(song=song,lyrics=lyrics) for song in data['songs']], + } \ No newline at end of file diff --git a/JioSaavn/_helper.py b/JioSaavn/__asyncrequests.py similarity index 55% rename from JioSaavn/_helper.py rename to JioSaavn/__asyncrequests.py index 0683ccf..7ce3435 100644 --- a/JioSaavn/_helper.py +++ b/JioSaavn/__asyncrequests.py @@ -1,20 +1,23 @@ -from ._requests import getText +import aiohttp +import json -def ucfirst(string:str): - return string.capitalize() +from .__useragent import getHeaders -def makeDifferentQualityMediaUrls(url:str): - replaced = url.replace("preview.saavncdn.com", "aac.saavncdn.com") - return {"96_KBPS": replaced.replace("_96_p", "_96"), - "160_KBPS": replaced.replace("_96_p", "_160"), - "320_KBPS": replaced.replace("_96_p", "_320"),} -def makeDifferentQualityImages(image:str): - image = image[:image.rfind('-')] - return {"50x50": f'{image}-50x50.jpg', - "150x150": f'{image}-150x150.jpg', - "500x500": f'{image}-500x500.jpg',} +async def getjSON(url:str): + async with aiohttp.ClientSession(headers=getHeaders()) as session: + async with session.get(url) as response: + assert response.status == 200,'ClientResponse 404' + return json.loads(await response.text()) + + +async def getText(url:str,data=None): + async with aiohttp.ClientSession(headers=getHeaders()) as session: + async with session.get(url,data=data) as response: + assert response.status == 200,'ClientResponse 404' + return await response.text() + async def getSongId(url:str): response = await getText(url,data=[('bitrate', '320')]) @@ -23,6 +26,7 @@ async def getSongId(url:str): except IndexError: return(response.split('"pid":"'))[1].split('","')[0] + async def getAlbumId(url:str): response = await getText(url) try: @@ -30,9 +34,11 @@ async def getAlbumId(url:str): except IndexError: return response.split('"page_id","')[1].split('","')[0] + async def getPlaylistId(url:str): response = await getText(url) try: return response.split('"type":"playlist","id":"')[1].split('"')[0] except IndexError: return response.split('"page_id","')[1].split('","')[0] + diff --git a/JioSaavn/_baseApiUrl.py b/JioSaavn/__baseApiUrl.py similarity index 100% rename from JioSaavn/_baseApiUrl.py rename to JioSaavn/__baseApiUrl.py diff --git a/JioSaavn/__constants.py b/JioSaavn/__constants.py new file mode 100644 index 0000000..256f6b4 --- /dev/null +++ b/JioSaavn/__constants.py @@ -0,0 +1,8 @@ + +# from enum import Enum + +# class Response(Enum): +# json = 'json' +# raw = 'raw' + +Response = ['json','raw'] \ No newline at end of file diff --git a/JioSaavn/_exceptions.py b/JioSaavn/__exceptions.py similarity index 97% rename from JioSaavn/_exceptions.py rename to JioSaavn/__exceptions.py index e46f8b7..4c565dd 100644 --- a/JioSaavn/_exceptions.py +++ b/JioSaavn/__exceptions.py @@ -1,3 +1,4 @@ + class Error(Exception): """Base class for exceptions in this module.""" pass @@ -6,7 +7,8 @@ class Error(Exception): class ValidationError(Error): def __init__(self, message: str) -> None: super().__init__(message) - + + class InvalidURL(Exception): """ URL is improperly formed or cannot be parsed. diff --git a/JioSaavn/__helper.py b/JioSaavn/__helper.py new file mode 100644 index 0000000..f5eaeef --- /dev/null +++ b/JioSaavn/__helper.py @@ -0,0 +1,17 @@ + +def ucfirst(string:str): + return string.capitalize() + +def makeDifferentQualityMediaUrls(url:str): + replaced = url.replace("preview.saavncdn.com", "aac.saavncdn.com") + return {"96_KBPS": replaced.replace("_96_p", "_96"), + "160_KBPS": replaced.replace("_96_p", "_160"), + "320_KBPS": replaced.replace("_96_p", "_320"),} + +def makeDifferentQualityImages(image:str): + image = image[:image.rfind('-')] + return {"50x50": f'{image}-50x50.jpg', + "150x150": f'{image}-150x150.jpg', + "500x500": f'{image}-500x500.jpg',} + + diff --git a/JioSaavn/__init__.py b/JioSaavn/__init__.py index 4017e73..d61ac98 100644 --- a/JioSaavn/__init__.py +++ b/JioSaavn/__init__.py @@ -1,14 +1,15 @@ -from JioSaavn._fetch import searchSong,searchAlbum,song,lyrics,album,playlist +# from .__asyncJioSaavn import JioSaavn +__version__ = 'v0.0.4' __title__ = "JioSaavn" __description__ = "JioSaavn Api for Python 3." -__all__ =[ - 'searchSong', - 'searchAlbum', - 'song', - 'album', - 'lyrics', - 'playlist', -] +# __all__ =[ +# 'searchSong', +# 'searchAlbum', +# 'song', +# 'album', +# 'lyrics', +# 'playlist', +# ] diff --git a/JioSaavn/__syncrequests.py b/JioSaavn/__syncrequests.py new file mode 100644 index 0000000..7676a5f --- /dev/null +++ b/JioSaavn/__syncrequests.py @@ -0,0 +1,40 @@ +import requests + +from .__useragent import getHeaders + + +def getjSON(url:str): + response = requests.get(url=url,headers=getHeaders()).json() + assert response.status == 200,'ClientResponse 404' + return response + + +def getText(url:str,data=None): + response = requests.get(url=url,headers=getHeaders(),params=data).text + assert response.status == 200,'ClientResponse 404' + return response + + +def getSongId(url:str): + response = getText(url,data=[('bitrate', '320')]) + try: + return response.split('"song":{"type":"')[1].split('","image":')[0].split('"id":"')[-1] + except IndexError: + return(response.split('"pid":"'))[1].split('","')[0] + + +def getAlbumId(url:str): + response = getText(url) + try: + return response.split('"album_id":"')[1].split('"')[0] + except IndexError: + return response.split('"page_id","')[1].split('","')[0] + + +def getPlaylistId(url:str): + response = getText(url) + try: + return response.split('"type":"playlist","id":"')[1].split('"')[0] + except IndexError: + return response.split('"page_id","')[1].split('","')[0] + diff --git a/JioSaavn/_useragent.py b/JioSaavn/__useragent.py similarity index 99% rename from JioSaavn/_useragent.py rename to JioSaavn/__useragent.py index 2999a78..5291737 100644 --- a/JioSaavn/_useragent.py +++ b/JioSaavn/__useragent.py @@ -7,6 +7,8 @@ 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.167 Safari/537.36', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.67 Safari/537.36' ] + + def getHeaders(): return { 'Host': 'www.jiosaavn.com', diff --git a/JioSaavn/_validation.py b/JioSaavn/__validation.py similarity index 100% rename from JioSaavn/_validation.py rename to JioSaavn/__validation.py diff --git a/JioSaavn/_fetch.py b/JioSaavn/_asyncFetch.py similarity index 86% rename from JioSaavn/_fetch.py rename to JioSaavn/_asyncFetch.py index 5885560..9fb346f 100644 --- a/JioSaavn/_fetch.py +++ b/JioSaavn/_asyncFetch.py @@ -1,19 +1,38 @@ from typing import Optional +from pydantic import validate_arguments, Field +from pydantic.typing import Annotated -from . import _baseApiUrl,_requests -from . import _parseResponse as parse -from ._helper import getSongId ,getAlbumId,getPlaylistId -from ._exceptions import ValidationError,InvalidURL -from ._validation import isAlbumUrl,isSongUrl,isPlaylistUrl +from . import __asyncrequests +from . import __baseApiUrl +from . import __asyncparseResponse +from .__asyncrequests import getSongId ,getAlbumId,getPlaylistId +from .__exceptions import ValidationError,InvalidURL +from .__validation import isAlbumUrl,isSongUrl,isPlaylistUrl +from .__constants import Response +__all__ =[ + 'searchSong', + 'searchAlbum', + 'song', + 'album', + 'lyrics', + 'playlist', +] -async def searchSong(query:str,page:int=1,limit:int=10): +@validate_arguments +async def searchSong(query:str,page:Annotated[int, Field(gt=0)]=1,limit:Annotated[int, Field(gt=0,lt=30)]=10,response:str='json'): '''Searches for song in JioSaavn. + Args: query (str): Sets the search query. page (int, optional): Sets page to the number of page. Defaults to 1. - limit (int, optional): Sets limit to the number of results. Defaults to 10. + limit (int, optional): Sets limit to the number of results. Defaults to 10. Max to 30. + response(str,optional): Sets the response of result. Defaults to `json`. + + Note: + To get raw result Set `response` to `raw` + Examples: Calling `searchSong` function gives the search result. >>> search = await searchSong('alone') @@ -67,13 +86,23 @@ async def searchSong(query:str,page:int=1,limit:int=10): ] ''' - return await parse.makeSearchResponse(data=await _requests.getjSON(url=_baseApiUrl.songsearchFromSTRING(query=query,p=page,n=limit))) + assert response in Response,'response should be json or raw' + result = await __asyncrequests.getjSON(url=__baseApiUrl.songsearchFromSTRING(query=query,p=page,n=limit)) + if response == 'raw': + return result + return await __asyncparseResponse.makeSearchResponse(data=result) -async def searchAlbum(query:str): +async def searchAlbum(query:str,response:str='json'): '''Searches for album in JioSaavn. + Args: query (str): Sets the search query. + response(str,optional): Sets the response of result. Defaults to `json`. + + Note: + To get raw result Set `response` to `raw` + Examples: Calling `searchAlbum` function gives the search result. >>> search = await searchAlbum('Alone') @@ -113,15 +142,25 @@ async def searchAlbum(query:str): }, ] ''' - return await parse.makeAlbumSearchResponse(data=await _requests.getjSON(_baseApiUrl.albumsearchFromSTRING(query=query))) + assert response in Response,'response should be json or raw' + result = await __asyncrequests.getjSON(__baseApiUrl.albumsearchFromSTRING(query=query)) + if response == 'raw': + return result + return await __asyncparseResponse.makeAlbumSearchResponse(data=result) -async def song(url:Optional[str]=None,id:Optional[str]=None,lyrics:bool=False): +async def song(url:Optional[str]=None,id:Optional[str]=None,lyrics:bool=False,response:str='json'): '''Get song info from JioSaavn. + Args: url (str): Sets the url of song. id (str): Sets the id of song. - lyrics (bool): Sets the lyrics whether to get lyrics. Defaults to False. + lyrics (bool): Sets the lyrics whether to get lyrics. Defaults to `False`. + response(str,optional): Sets the response of result. Defaults to `json`. + + Note: + To get raw result Set `response` to `raw` + Examples: Calling `song` function gives the search result. >>> result = await song(id='veJXEDAz') @@ -169,16 +208,25 @@ async def song(url:Optional[str]=None,id:Optional[str]=None,lyrics:bool=False): if not isSongUrl(url=url): raise InvalidURL('Please provide a valid jiosaavn song url') id = await getSongId(url=url) - response = await _requests.getjSON(url=_baseApiUrl.songFromID(id=id)) - return await parse.makeSongResponse(song=response[id],lyrics=lyrics) + assert response in Response,'response should be json or raw' + result = await __asyncrequests.getjSON(url=__baseApiUrl.songFromID(id=id)) + if response == 'raw': + return result + return await __asyncparseResponse.makeSongResponse(song=result[id],lyrics=lyrics) -async def album(url:Optional[str]=None,id:Optional[str]=None,lyrics:bool=False): - '''Searches for album in JioSaavn. +async def album(url:Optional[str]=None,id:Optional[str]=None,lyrics:bool=False,response:str='json'): + '''Get album info from JioSaavn. + Args: url (str): Sets the url of album. id (str): Sets the id of album. - lyrics (bool): Sets the lyrics whether to get lyrics. Defaults to False. + lyrics (bool): Sets the lyrics whether to get lyrics. Defaults to `False`. + response(str,optional): Sets the response of result. Defaults to `json`. + + Note: + To get raw result Set `response` to `raw` + Examples: Calling `album` function gives the search result. >>> result = await album(id='10496527') @@ -320,14 +368,25 @@ async def album(url:Optional[str]=None,id:Optional[str]=None,lyrics:bool=False): if not isAlbumUrl(url=url): raise InvalidURL('Please provide a valid jiosaavn album url') id = await getAlbumId(url) - return await parse.makeAlbumResponse(data=await _requests.getjSON(_baseApiUrl.albumFromID(id=id)),lyrics=lyrics) + assert response in Response,'response should be json or raw' + result = await __asyncrequests.getjSON(__baseApiUrl.albumFromID(id=id)) + if response == 'raw': + return result + return await __asyncparseResponse.makeAlbumResponse(data=result,lyrics=lyrics) -async def playlist(url:Optional[str]=None,id:Optional[str]=None,lyrics:bool=False): - '''Searches for album in JioSaavn. + +async def playlist(url:Optional[str]=None,id:Optional[str]=None,lyrics:bool=False,response:str='json'): + '''Get playlist info from JioSaavn. + Args: url (str): Sets the url of playlist. id (str): Sets the id of playlist. - lyrics (bool): Sets the lyrics whether to get lyrics. Defaults to False. + lyrics (bool): Sets the lyrics whether to get lyrics. Defaults to `False`. + response(str,optional): Sets the response of result. Defaults to `json`. + + Note: + To get raw result Set `response` to `raw` + Examples: Calling `playlist` function gives the search result. >>> result = await playlist(url='https://www.jiosaavn.com/s/playlist/88063878238ad9a391a33c0e628d2b01/90s_Love/OykxHSA0YytFo9wdEAzFBA__') @@ -468,14 +527,24 @@ async def playlist(url:Optional[str]=None,id:Optional[str]=None,lyrics:bool=Fals if not isPlaylistUrl(url=url): raise InvalidURL('Please provide a valid jiosaavn playlist url') id = await getPlaylistId(url) - return await parse.makePlaylistResponse(data= await _requests.getjSON(url=_baseApiUrl.playlistFromID(id=id)),lyrics=lyrics) + assert response in Response,'response should be json or raw' + result = await __asyncrequests.getjSON(url=__baseApiUrl.playlistFromID(id=id)) + if response == 'raw': + return result + return await __asyncparseResponse.makePlaylistResponse(data=result ,lyrics=lyrics) -async def lyrics(url:Optional[str]=None,id:Optional[str]=None): - '''Get lyrics of a song from id (If Available) +async def lyrics(url:Optional[str]=None,id:Optional[str]=None,response:str='json'): + '''Get lyrics of a song (If Available) + Args: url (str): Sets the url of playlist. id (str): Sets the id of song. + response(str,optional): Sets the response of result. Defaults to `json`. + + Note: + To get raw result Set `response` to `raw` + Examples: Calling `lyrics` function gives the search result. >>> result = await lyrics(id='blMuXL1P') @@ -492,10 +561,13 @@ async def lyrics(url:Optional[str]=None,id:Optional[str]=None): if not isSongUrl(url=url): raise InvalidURL('Please provide a valid jiosaavn song url') id = await getSongId(url=url) - data = await _requests.getjSON(_baseApiUrl.lyricsFromID(id=id)) - if data.get('status' ) == "failure": + assert response in Response,'response should be json or raw' + result = await __asyncrequests.getjSON(__baseApiUrl.lyricsFromID(id=id)) + if response == 'raw': + return result + if result.get('status' ) == "failure": return {'status': f'no lyric'} - return {'lyrics':data.get('lyrics'), - 'lyrics_copyright':data.get('lyrics_copyright'), - 'snippet':data.get('snippet') + return {'lyrics':result.get('lyrics'), + 'lyrics_copyright':result.get('lyrics_copyright'), + 'snippet':result.get('snippet') } \ No newline at end of file diff --git a/JioSaavn/_parseResponse.py b/JioSaavn/_parseResponse.py deleted file mode 100644 index fa17841..0000000 --- a/JioSaavn/_parseResponse.py +++ /dev/null @@ -1,99 +0,0 @@ - -from . import _fetch ,_helper - - -async def makeSearchResponse(data): - result =[] - for i in data['results']: - images = _helper.makeDifferentQualityImages(i['image']) - singers = ', '.join([q['name'] for q in i['more_info']['artistMap']['primary_artists']]) - data = { - 'id':i['id'], - 'title':i['title'], - 'image':images["150x150"], - 'images':images, - 'album':i['more_info']['album'], - 'description':f"{i['more_info']['album']} - {singers}" if singers else i['more_info']['album'], - 'has_lyrics':i['more_info']['has_lyrics'], - 'singers':singers.split(', '), - 'language':_helper.ucfirst(i['language']), - 'album_id':i['more_info']['album_id'], - 'url':{ - 'song':i['perma_url'], - 'album':i['more_info']['album_url'], - }, - } - result.append(data) - return result - -async def makeSongResponse(song,lyrics:bool=False): - media_urls = _helper.makeDifferentQualityMediaUrls(song['media_preview_url']) - images = _helper.makeDifferentQualityImages(song['image']) - return { - 'id': song['id'], - 'song': song['song'], - 'album': song['album'], - 'year': song['year'], - 'primary_artists': (song['primary_artists']).split(', '), - 'singers': (song['singers']).split(', '), - 'image': images["500x500"], - 'images':images, - 'duration': song['duration'], - 'label': song['label'], - 'albumid': song['albumid'], - 'language': _helper.ucfirst(song['language']), - 'copyright_text': song['copyright_text'], - 'has_lyrics': song['has_lyrics'], - 'lyrics': await _fetch.lyrics(song['id']) if song['has_lyrics'] == "true" and lyrics else None, - 'media_url': media_urls["160_KBPS"], - 'media_urls':media_urls, - 'release_date': song['release_date'], - 'url':{ - 'song': song['perma_url'], - 'album': song['album_url'], - }, - } - -async def makeAlbumSearchResponse(data): - result =[] - for i in data['albums']['data']: - images = _helper.makeDifferentQualityImages(i['image']) - _data = { - 'id': i['id'], - 'title': i['title'], - 'image': images["150x150"], - 'images':images, - 'music': i['music'], - 'description': i['description'], - 'year': i['more_info']['year'], - 'language': _helper.ucfirst(i['more_info']['language']), - 'url': i['url'], - 'song':i['more_info']['song_pids'], - } - result.append(_data) - return result - -async def makeAlbumResponse(data,lyrics:bool=False): - return { - 'albumid': data['albumid'], - 'title': data['title'], - 'name': data['name'], - 'year': data['year'], - 'primary_artists': (data['primary_artists']).split(', '), - 'image': data['image'], - 'songs':[await makeSongResponse(song=song,lyrics=lyrics) for song in data['songs']], - 'perma_url': data['perma_url'], - 'release_date': data['release_date'], - } - -async def makePlaylistResponse(data,lyrics:bool=False): - return { - 'listid': data['listid'], - 'title': data['listname'], - 'username': data['username'], - 'list_count': data['list_count'], - 'uid': data['uid'], - 'perma_url': data['perma_url'], - 'image': data['image'], - 'songs':[await makeSongResponse(song=song,lyrics=lyrics) for song in data['songs']], - } \ No newline at end of file diff --git a/JioSaavn/_requests.py b/JioSaavn/_requests.py deleted file mode 100644 index ce6d974..0000000 --- a/JioSaavn/_requests.py +++ /dev/null @@ -1,20 +0,0 @@ - -import aiohttp -import json - -from ._useragent import getHeaders - - -async def getjSON(url:str): - async with aiohttp.ClientSession(headers=getHeaders()) as session: - async with session.get(url) as response: - if not response.status == 404: - return json.loads(await response.text()) - return None - -async def getText(url:str,data=None): - async with aiohttp.ClientSession(headers=getHeaders()) as session: - async with session.get(url,data=data) as response: - if not response.status == 404: - return await response.text() - return None diff --git a/setup.py b/setup.py index 1c07d24..1b2cb70 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ setup( name = 'JioSaavn', packages = ['JioSaavn'], - version = 'v0.0.3', + version = 'v0.0.4', license='MIT', description = 'Search for JioSaavn songs & album. Get song ,album & lyric information.', long_description=long_description, @@ -20,6 +20,8 @@ keywords = ['jiosaavn', 'jiosaavnapi', 'songs', 'albums', 'lyrics'], install_requires=[ 'aiohttp', + 'pydantic', + 'requests', ], include_package_data=True, zip_safe=False, diff --git a/test.py b/test.py new file mode 100644 index 0000000..b8cc105 --- /dev/null +++ b/test.py @@ -0,0 +1,23 @@ +import asyncio + +from JioSaavn.Async import JioSaavn + +jiosaavn = JioSaavn() + +async def defMain(): + # with print_durations('to call defMain'): + # data = await jiosaavn.song(id='veJXEDAz',)#response='raw') + # data = await jiosaavn.searchSong('alone', ) + # data = await jiosaavn.searchAlbum('Alone',response='raw' ) + data = await jiosaavn.playlist(url='https://www.jiosaavn.com/s/playlist/88063878238ad9a391a33c0e628d2b01/90s_Love/OykxHSA0YytFo9wdEAzFBA__') + + print(data) + +async def main(): + await defMain() + # print(Response) + + + +loop = asyncio.get_event_loop() +loop.run_until_complete(main()) \ No newline at end of file From 2f115ab4542acc5d7a738838a921faee87f56aa7 Mon Sep 17 00:00:00 2001 From: vidya sagar Date: Sat, 11 Dec 2021 19:26:38 +0530 Subject: [PATCH 2/3] updated docstrings --- JioSaavn/Sync.py | 14 + JioSaavn/__asyncJioSaavn.py | 419 +-- ..._asyncparseResponse.py => __asyncparse.py} | 2 - JioSaavn/__asyncrequests.py | 23 - JioSaavn/__helper.py | 20 + JioSaavn/__init__.py | 26 +- JioSaavn/__syncJioSaavn.py | 137 + JioSaavn/__syncparse.py | 91 + JioSaavn/__syncrequests.py | 36 +- JioSaavn/_asyncFetch.py | 425 +-- JioSaavn/_syncFetch.py | 196 ++ README.md | 2351 ++++++++++++++--- setup.py | 10 +- test.py | 24 +- 14 files changed, 2511 insertions(+), 1263 deletions(-) create mode 100644 JioSaavn/Sync.py rename JioSaavn/{__asyncparseResponse.py => __asyncparse.py} (97%) create mode 100644 JioSaavn/__syncJioSaavn.py create mode 100644 JioSaavn/__syncparse.py create mode 100644 JioSaavn/_syncFetch.py diff --git a/JioSaavn/Sync.py b/JioSaavn/Sync.py new file mode 100644 index 0000000..998cb31 --- /dev/null +++ b/JioSaavn/Sync.py @@ -0,0 +1,14 @@ +from .__syncJioSaavn import JioSaavn + +from ._syncFetch import searchSong,searchAlbum,song,album,playlist,lyrics + + +__all__ =[ + 'JioSaavn', + 'searchSong', + 'searchAlbum', + 'song', + 'album', + 'playlist', + 'lyrics' +] diff --git a/JioSaavn/__asyncJioSaavn.py b/JioSaavn/__asyncJioSaavn.py index 5bdebac..9e796f2 100644 --- a/JioSaavn/__asyncJioSaavn.py +++ b/JioSaavn/__asyncJioSaavn.py @@ -3,7 +3,9 @@ from . import _asyncFetch class JioSaavn: - + ''' + ### Create an instance of JioSaavn with async methods. + ''' @staticmethod async def searchSong(query:str,page:int=1,limit:int=10,response:str='json'): '''Searches for song in JioSaavn. @@ -18,58 +20,12 @@ async def searchSong(query:str,page:int=1,limit:int=10,response:str='json'): To get raw result Set `response` to `raw` Example: - Calling `searchSong` method gives the search result of songs. - >>> from JioSaavn.Async import jiosaavn - >>> search = await jiosaavn.searchSong('alone') + Calling `searchSong` method gives the search result. + >>> from jiosaavn.Async import JioSaavn + >>> search = await JioSaavn.searchSong('alone') >>> print(search) - [ - { - "id": "HgyjuLNF", - "title": "Alone Alone (From "Malli Modalaindi")", - "image": "https://c.saavncdn.com/156/Alone-Alone-From-Malli-Modalaindi--Telugu-2021-20210920131019-150x150.jpg", - "images": { - "50x50": "https://c.saavncdn.com/156/Alone-Alone-From-Malli-Modalaindi--Telugu-2021-20210920131019-50x50.jpg", - "150x150": "https://c.saavncdn.com/156/Alone-Alone-From-Malli-Modalaindi--Telugu-2021-20210920131019-150x150.jpg", - "500x500": "https://c.saavncdn.com/156/Alone-Alone-From-Malli-Modalaindi--Telugu-2021-20210920131019-500x500.jpg" - }, - "album": "Alone Alone (From "Malli Modalaindi")", - "description": "Alone Alone (From "Malli Modalaindi") - Sid Sriram, Anup Rubens", - "has_lyrics": "false", - "singers": [ - "Sid Sriram", - "Anup Rubens" - ], - "language": "Telugu", - "album_id": "29782034", - "url": { - "song": "https://www.jiosaavn.com/song/alone-alone-from-malli-modalaindi/OA8SWwF8eXU", - "album": "https://www.jiosaavn.com/album/alone-alone-from-malli-modalaindi/lLQ4oVnaTvM_" - }, - }, - { - "id": "veJXEDAz", - "title": "Alone", - "image": "https://c.saavncdn.com/743/Alone-Punjabi-2020-20200507184621-150x150.jpg", - "images": { - "50x50": "https://c.saavncdn.com/743/Alone-Punjabi-2020-20200507184621-50x50.jpg", - "150x150": "https://c.saavncdn.com/743/Alone-Punjabi-2020-20200507184621-150x150.jpg", - "500x500": "https://c.saavncdn.com/743/Alone-Punjabi-2020-20200507184621-500x500.jpg" - }, - "album": "Alone", - "description": "Alone - Raashi Sood", - "has_lyrics": "false", - "singers": [ - "Raashi Sood" - ], - "language": "Punjabi", - "album_id": "20256407", - "url": { - "song": "https://www.jiosaavn.com/song/alone/Bg0haTF0dkk", - "album": "https://www.jiosaavn.com/album/alone/,kQ0LrBIybc_" - }, - } - ] - ''' + + ''' return await _asyncFetch.searchSong(query=query,page=page,limit=limit,response=response) @staticmethod @@ -85,43 +41,10 @@ async def searchAlbum(query:str,response:str='json'): Examples: Calling `searchAlbum` method gives the search result of albums. - >>> from JioSaavn.Async import jiosaavn - >>> search = await jiosaavn.searchAlbum('Alone') + >>> from jiosaavn.Async import JioSaavn + >>> search = await JioSaavn.searchAlbum('Alone') >>> print(search) - [ - { - "id": "29782034", - "title": "Alone Alone (From "Malli Modalaindi")", - "image": "https://c.saavncdn.com/156/Alone-Alone-From-Malli-Modalaindi--Telugu-2021-20210920131019-150x150.jpg", - "images": { - "50x50": "https://c.saavncdn.com/156/Alone-Alone-From-Malli-Modalaindi--Telugu-2021-20210920131019-50x50.jpg", - "150x150": "https://c.saavncdn.com/156/Alone-Alone-From-Malli-Modalaindi--Telugu-2021-20210920131019-150x150.jpg", - "500x500": "https://c.saavncdn.com/156/Alone-Alone-From-Malli-Modalaindi--Telugu-2021-20210920131019-500x500.jpg" - }, - "music": "Sid Sriram, Anup Rubens", - "description": "2021 · Telugu Album · Sid Sriram, Anup Rubens", - "year": "2021", - "language": "Telugu", - "url": "https://www.jiosaavn.com/album/alone-alone-from-malli-modalaindi/lLQ4oVnaTvM_", - "song": "HgyjuLNF", - }, - { - "id": "1215558", - "title": "Alone", - "image": "https://c.saavncdn.com/794/Alone-Hindi-2014-150x150.jpg", - "images": { - "50x50": "https://c.saavncdn.com/794/Alone-Hindi-2014-50x50.jpg", - "150x150": "https://c.saavncdn.com/794/Alone-Hindi-2014-150x150.jpg", - "500x500": "https://c.saavncdn.com/794/Alone-Hindi-2014-500x500.jpg" - }, - "music": "Ankit Tiwari", - "description": "2014 · Hindi Film · Ankit Tiwari", - "year": "2014", - "language": "Hindi", - "url": "https://www.jiosaavn.com/album/alone/MmI5C7Qd8xU_", - "song": "woZT1XKb, BW3ZjaVE, 30LGCvEo, IVnaw30E", - }, - ] + ''' return await _asyncFetch.searchAlbum(query=query,response=response) @@ -140,45 +63,10 @@ async def song(url:Optional[str]=None,id:Optional[str]=None,lyrics:bool=False,re Examples: Calling `song` method gives the song info. - >>> from JioSaavn.Async import jiosaavn - >>> result = await jiosaavn.song(id='veJXEDAz') + >>> from jiosaavn.Async import JioSaavn + >>> result = await JioSaavn.song(id='veJXEDAz') >>> print(result) - { - "id": "veJXEDAz", - "song": "Alone", - "album": "Alone", - "year": "2020", - "primary_artists": [ - "Raashi Sood" - ], - "singers": [ - "Raashi Sood" - ], - "image": "https://c.saavncdn.com/743/Alone-Punjabi-2020-20200507184621-500x500.jpg", - "images": { - "50x50": "https://c.saavncdn.com/743/Alone-Punjabi-2020-20200507184621-50x50.jpg", - "150x150": "https://c.saavncdn.com/743/Alone-Punjabi-2020-20200507184621-150x150.jpg", - "500x500": "https://c.saavncdn.com/743/Alone-Punjabi-2020-20200507184621-500x500.jpg" - }, - "duration": "120", - "label": "Raashi Sood Music", - "albumid": "20256407", - "language": "Punjabi", - "copyright_text": "© 2020 Raashi Sood Music", - "has_lyrics": "false", - "lyrics": null, - "media_url": "https://aac.saavncdn.com/743/dc78d52426dff2c0bf8e755c4721c398_160.mp4", - "media_urls": { - "96_KBPS": "https://aac.saavncdn.com/743/dc78d52426dff2c0bf8e755c4721c398_96.mp4", - "160_KBPS": "https://aac.saavncdn.com/743/dc78d52426dff2c0bf8e755c4721c398_160.mp4", - "320_KBPS": "https://aac.saavncdn.com/743/dc78d52426dff2c0bf8e755c4721c398_320.mp4" - }, - "release_date": "2020-05-07", - "url": { - "song": "https://www.jiosaavn.com/song/alone/Bg0haTF0dkk", - "album": "https://www.jiosaavn.com/album/alone/,kQ0LrBIybc_" - }, - } + ''' return await _asyncFetch.song(url=url,id=id,lyrics=lyrics,response=response) @@ -197,139 +85,10 @@ async def album(url:Optional[str]=None,id:Optional[str]=None,lyrics:bool=False,r Examples: Calling `album` method gives the album info. - >>> from JioSaavn.Async import jiosaavn - >>> result = await jiosaavn.album(id='10496527') + >>> from jiosaavn.Async import JioSaavn + >>> result = await JioSaavn.album(id='10496527') >>> print(result) - { - "albumid": "10496527", - "title": "Baahubali 2 - The Conclusion", - "name": "Baahubali 2 - The Conclusion", - "year": "2017", - "primary_artists": [ - "M. M. Keeravani" - ], - "image": "https://c.saavncdn.com/271/Baahubali-2-The-Conclusion-Telugu-2017-150x150.jpg", - "songs": [ - { - "id": "blMuXL1P", - "song": "Saahore Baahubali", - "album": "Baahubali 2 - The Conclusion", - "year": "2017", - "primary_artists": [ - "Daler Mehndi", - "M. M. Keeravani", - "Mounima Ch" - ], - "singers": [ - "Daler Mehndi", - "M. M. Keeravani", - "Mounima Ch" - ], - "image": "https://c.saavncdn.com/271/Baahubali-2-The-Conclusion-Telugu-2017-500x500.jpg", - "images": { - "50x50": "https://c.saavncdn.com/271/Baahubali-2-The-Conclusion-Telugu-2017-50x50.jpg", - "150x150": "https://c.saavncdn.com/271/Baahubali-2-The-Conclusion-Telugu-2017-150x150.jpg", - "500x500": "https://c.saavncdn.com/271/Baahubali-2-The-Conclusion-Telugu-2017-500x500.jpg" - }, - "duration": "203", - "label": "Lahari Music", - "albumid": "10496527", - "language": "Telugu", - "copyright_text": "© 2017 Lahari Music", - "has_lyrics": "true", - "lyrics": null, - "media_url": "https://aac.saavncdn.com/271/22dda6f74d38544c0b0d27d65ddddac1_160.mp4", - "media_urls": { - "96_KBPS": "https://aac.saavncdn.com/271/22dda6f74d38544c0b0d27d65ddddac1_96.mp4", - "160_KBPS": "https://aac.saavncdn.com/271/22dda6f74d38544c0b0d27d65ddddac1_160.mp4", - "320_KBPS": "https://aac.saavncdn.com/271/22dda6f74d38544c0b0d27d65ddddac1_320.mp4" - }, - "release_date": "2017-03-26", - "url": { - "song": "https://www.jiosaavn.com/song/saahore-baahubali/EgQmRCx8BmM", - "album": "https://www.jiosaavn.com/album/baahubali-2---the-conclusion/Vm5jaOSkM7E_" - }, - }, - { - "id": "XvwEmXL_", - "song": "Hamsa Naava", - "album": "Baahubali 2 - The Conclusion", - "year": "2017", - "primary_artists": [ - "Sony", - "Deepu" - ], - "singers": [ - "Sony", - "Deepu" - ], - "image": "https://c.saavncdn.com/271/Baahubali-2-The-Conclusion-Telugu-2017-500x500.jpg", - "images": { - "50x50": "https://c.saavncdn.com/271/Baahubali-2-The-Conclusion-Telugu-2017-50x50.jpg", - "150x150": "https://c.saavncdn.com/271/Baahubali-2-The-Conclusion-Telugu-2017-150x150.jpg", - "500x500": "https://c.saavncdn.com/271/Baahubali-2-The-Conclusion-Telugu-2017-500x500.jpg" - }, - "duration": "204", - "label": "Lahari Music", - "albumid": "10496527", - "language": "Telugu", - "copyright_text": "© 2017 Lahari Music", - "has_lyrics": "true", - "lyrics": null, - "media_url": "https://aac.saavncdn.com/271/5d651eeaa54b93af16a7c39999615f2d_160.mp4", - "media_urls": { - "96_KBPS": "https://aac.saavncdn.com/271/5d651eeaa54b93af16a7c39999615f2d_96.mp4", - "160_KBPS": "https://aac.saavncdn.com/271/5d651eeaa54b93af16a7c39999615f2d_160.mp4", - "320_KBPS": "https://aac.saavncdn.com/271/5d651eeaa54b93af16a7c39999615f2d_320.mp4" - }, - "release_date": "2017-03-26", - "url": { - "song": "https://www.jiosaavn.com/song/hamsa-naava/KB4cdBloe2w", - "album": "https://www.jiosaavn.com/album/baahubali-2---the-conclusion/Vm5jaOSkM7E_" - }, - }, - { - "id": "M3D7qn6T", - "song": "Kannaa Nidurinchara", - "album": "Baahubali 2 - The Conclusion", - "year": "2017", - "primary_artists": [ - "Sreenidhi Tirumala", - "V. Srisoumya" - ], - "singers": [ - "Sreenidhi Tirumala", - "V. Srisoumya" - ], - "image": "https://c.saavncdn.com/271/Baahubali-2-The-Conclusion-Telugu-2017-500x500.jpg", - "images": { - "50x50": "https://c.saavncdn.com/271/Baahubali-2-The-Conclusion-Telugu-2017-50x50.jpg", - "150x150": "https://c.saavncdn.com/271/Baahubali-2-The-Conclusion-Telugu-2017-150x150.jpg", - "500x500": "https://c.saavncdn.com/271/Baahubali-2-The-Conclusion-Telugu-2017-500x500.jpg" - }, - "duration": "291", - "label": "Lahari Music", - "albumid": "10496527", - "language": "Telugu", - "copyright_text": "© 2017 Lahari Music", - "has_lyrics": "true", - "lyrics": null, - "media_url": "https://aac.saavncdn.com/271/5e4fe5350641ff6c285d79676a483222_160.mp4", - "media_urls": { - "96_KBPS": "https://aac.saavncdn.com/271/5e4fe5350641ff6c285d79676a483222_96.mp4", - "160_KBPS": "https://aac.saavncdn.com/271/5e4fe5350641ff6c285d79676a483222_160.mp4", - "320_KBPS": "https://aac.saavncdn.com/271/5e4fe5350641ff6c285d79676a483222_320.mp4" - }, - "release_date": "2017-03-26", - "url": { - "song": "https://www.jiosaavn.com/song/kannaa-nidurinchara/PVsvBgVeAWc", - "album": "https://www.jiosaavn.com/album/baahubali-2---the-conclusion/Vm5jaOSkM7E_" - }, - }, - ], - "perma_url": "https://www.jiosaavn.com/album/baahubali-2---the-conclusion/Vm5jaOSkM7E_", - "release_date": "2017-03-26" - } + ''' return await _asyncFetch.album(url=url,id=id,lyrics=lyrics,response=response) @@ -348,138 +107,10 @@ async def playlist(url:Optional[str]=None,id:Optional[str]=None,lyrics:bool=Fals Examples: Calling `playlist` method gives the playlist info. - >>> from JioSaavn.Async import jiosaavn - >>> result = await jiosaavn.playlist(url='https://www.jiosaavn.com/s/playlist/88063878238ad9a391a33c0e628d2b01/90s_Love/OykxHSA0YytFo9wdEAzFBA__') + >>> from jiosaavn.Async import JioSaavn + >>> result = await JioSaavn.playlist(url='https://www.jiosaavn.com/s/playlist/88063878238ad9a391a33c0e628d2b01/90s_Love/OykxHSA0YytFo9wdEAzFBA__') >>> print(result) - { - "listid": "268477478", - "title": "90's Love", - "username": "", - "list_count": "17", - "uid": "88063878238ad9a391a33c0e628d2b01", - "perma_url": "https://www.jiosaavn.com/s/playlist/88063878238ad9a391a33c0e628d2b01/90s_Love/OykxHSA0YytFo9wdEAzFBA__", - "image": "https://pli.saavncdn.com/74/78/268477478.jpg?bch=1555760417", - "songs": [ - { - "id": "2XLkr2Gd", - "song": "Kal Ho Naa Ho", - "album": "Kal Ho Naa Ho (Original Motion Picture Soundtrack)", - "year": "2003", - "primary_artists": [ - "Shankar-Ehsaan-Loy", - "Sonu Nigam" - ], - "singers": [ - "Shankar-Ehsaan-Loy", - "Sonu Nigam" - ], - "image": "https://c.saavncdn.com/909/Kal-Ho-Naa-Ho-Hindi-2003-500x500.jpg", - "images": { - "50x50": "https://c.saavncdn.com/909/Kal-Ho-Naa-Ho-Hindi-2003-50x50.jpg", - "150x150": "https://c.saavncdn.com/909/Kal-Ho-Naa-Ho-Hindi-2003-150x150.jpg", - "500x500": "https://c.saavncdn.com/909/Kal-Ho-Naa-Ho-Hindi-2003-500x500.jpg" - }, - "duration": "321", - "label": "Sony Music Entertainment India Pvt. Ltd.", - "albumid": "1208084", - "language": "Hindi", - "copyright_text": "(P) 2003 Sony Music Entertainment India Pvt. Ltd.", - "has_lyrics": "false", - "lyrics": null, - "media_url": "https://aac.saavncdn.com/909/b34c95486eb42ede300a549da19a38ad_160.mp4", - "media_urls": { - "96_KBPS": "https://aac.saavncdn.com/909/b34c95486eb42ede300a549da19a38ad_96.mp4", - "160_KBPS": "https://aac.saavncdn.com/909/b34c95486eb42ede300a549da19a38ad_160.mp4", - "320_KBPS": "https://aac.saavncdn.com/909/b34c95486eb42ede300a549da19a38ad_320.mp4" - }, - "release_date": "2003-09-20", - "url": { - "song": "https://www.jiosaavn.com/song/kal-ho-naa-ho/QjAnWgYCcFc", - "album": "https://www.jiosaavn.com/album/kal-ho-naa-ho-original-motion-picture-soundtrack/wxleSiR74Dg_" - } - }, - { - "id": "lULDgPcz", - "song": "Main Hoon Na", - "album": "Main Hoon Na", - "year": "2004", - "primary_artists": [ - "Sonu Nigam", - "Shreya Ghoshal" - ], - "singers": [ - "Sonu Nigam", - "Shreya Ghoshal" - ], - "image": "https://c.saavncdn.com/388/Main-Hoon-Na-Hindi-2004-500x500.jpg", - "images": { - "50x50": "https://c.saavncdn.com/388/Main-Hoon-Na-Hindi-2004-50x50.jpg", - "150x150": "https://c.saavncdn.com/388/Main-Hoon-Na-Hindi-2004-150x150.jpg", - "500x500": "https://c.saavncdn.com/388/Main-Hoon-Na-Hindi-2004-500x500.jpg" - }, - "duration": "361", - "label": "", - "albumid": "1037222", - "language": "Hindi", - "copyright_text": "© 2004 ", - "has_lyrics": "true", - "lyrics": null, - "media_url": "https://aac.saavncdn.com/388/348841a9282b5b362526a8098a7f4491_160.mp4", - "media_urls": { - "96_KBPS": "https://aac.saavncdn.com/388/348841a9282b5b362526a8098a7f4491_96.mp4", - "160_KBPS": "https://aac.saavncdn.com/388/348841a9282b5b362526a8098a7f4491_160.mp4", - "320_KBPS": "https://aac.saavncdn.com/388/348841a9282b5b362526a8098a7f4491_320.mp4" - }, - "release_date": "2004-02-27", - "url": { - "song": "https://www.jiosaavn.com/song/main-hoon-na/HD0ndRNgVEk", - "album": "https://www.jiosaavn.com/album/main-hoon-na/Gf2uDkAyAkg_" - } - }, - { - "id": "jFerJMnc", - "song": "Koi Mil Gaya", - "album": "Kuch Kuch Hota Hai (Original Motion Picture Soundtrack)", - "year": "1998", - "primary_artists": [ - "Jatin-Lalit", - "Kavita Krishnamurthy", - "Udit Narayan", - "Alka Yagnik" - ], - "singers": [ - "Jatin-Lalit", - "Kavita Krishnamurthy", - "Udit Narayan", - "Alka Yagnik" - ], - "image": "https://c.saavncdn.com/907/Kuch-Kuch-Hota-Hai-Hindi-1998-20190516130035-500x500.jpg", - "images": { - "50x50": "https://c.saavncdn.com/907/Kuch-Kuch-Hota-Hai-Hindi-1998-20190516130035-50x50.jpg", - "150x150": "https://c.saavncdn.com/907/Kuch-Kuch-Hota-Hai-Hindi-1998-20190516130035-150x150.jpg", - "500x500": "https://c.saavncdn.com/907/Kuch-Kuch-Hota-Hai-Hindi-1998-20190516130035-500x500.jpg" - }, - "duration": "437", - "label": "Sony Music Entertainment India Pvt. Ltd.", - "albumid": "1035265", - "language": "Hindi", - "copyright_text": "(P) 1998 Sony Music Entertainment India Pvt. Ltd.", - "has_lyrics": "false", - "lyrics": null, - "media_url": "https://aac.saavncdn.com/907/2d22f49ec5435c9d606742ae2648a5a2_160.mp4", - "media_urls": { - "96_KBPS": "https://aac.saavncdn.com/907/2d22f49ec5435c9d606742ae2648a5a2_96.mp4", - "160_KBPS": "https://aac.saavncdn.com/907/2d22f49ec5435c9d606742ae2648a5a2_160.mp4", - "320_KBPS": "https://aac.saavncdn.com/907/2d22f49ec5435c9d606742ae2648a5a2_320.mp4" - }, - "release_date": "1998-08-19", - "url": { - "song": "https://www.jiosaavn.com/song/koi-mil-gaya/Gi4OQz59WVA", - "album": "https://www.jiosaavn.com/album/kuch-kuch-hota-hai-original-motion-picture-soundtrack/zvqnBMKjQeM_" - } - }, - ] - } + ''' return await _asyncFetch.playlist(url=url,id=id,lyrics=lyrics,response=response) @@ -497,14 +128,10 @@ async def lyrics(url:Optional[str]=None,id:Optional[str]=None,response:str='json Examples: Calling `lyrics` method gives the lyrics of song. - >>> from JioSaavn.Async import jiosaavn - >>> result = await jiosaavn.lyrics(id='blMuXL1P') + >>> from jiosaavn.Async import JioSaavn + >>> result = await JioSaavn.lyrics(id='blMuXL1P') >>> print(result) - { - "lyrics": "bhali bhali bhalira bhali
sahore bahubali
bhali bhali bhalira bhali
sahore bahubali
jayaarti nike pattali pattali
bhuvanalanni jai kottali
gaganale chhatra pattali

haiss rudrass haisarbhadra samudrass
haiss rudrass haisarbhadra samudrass
haiss rudrass haisarbhadra samudrass
haiss rudrass haisarbhadra samudrass

aa janani deeksha achalam
i koduke kavachan
ippuda ammaki amm ainanduka
pulkarinchindiga i kshana

aduulu guttal mittal gaminch
pidikit pidugul patti minch
arikul vargal durgal jayinch
avaniki swarganne dinch

ant maha baludina amm ori pasiwade
shivudaina bhavudaina ammaku sat kadantade

haiss rudrass haisarbhadra samudrass
haiss rudrass haisarbhadra samudrass
haiss rudrass haiss rudrass
haisarbhadra samudrass haisarbhadra samudrass
haiss rudrass haisarbhadra samudrass
haiss rudrass haisarbhadra samudrass
haiss rudrass haisarbhadra samudrass
haiss rudrass haisarbhadra samudrass
haiss rudrass haisarbhadra samudrass

bhali bhali bhalira bhali
sahore bahubali
jayaarti nike pattali
bhali bhali bhalira bhali
sahore bahubali
jayaarti nike pattali pattali
bhuvanalanni jai kottali
gaganale chhatra pattali", - "lyrics_copyright": "Writer(s): M. M. Keeravaani, Shiva Shakthi Datta, K. Ramakrishna Lyrics powered by www.musixmatch.com", - "snippet": "haiss rudrass haisarbhadra samudrass" - } + ''' return await _asyncFetch.lyrics(url=url,id=id,response=response) diff --git a/JioSaavn/__asyncparseResponse.py b/JioSaavn/__asyncparse.py similarity index 97% rename from JioSaavn/__asyncparseResponse.py rename to JioSaavn/__asyncparse.py index 4402b63..4e55846 100644 --- a/JioSaavn/__asyncparseResponse.py +++ b/JioSaavn/__asyncparse.py @@ -1,5 +1,4 @@ -import re from . import __helper from . import _asyncFetch @@ -49,7 +48,6 @@ async def makeSearchResponse(data): 'language':__helper.ucfirst(i['language']), 'songUrl':i['perma_url'], 'albumUrl':i['more_info']['album_url'], - 'labelUrl':f"https://www.jiosaavn.com{i['label_url']}", } for i in data['results']] diff --git a/JioSaavn/__asyncrequests.py b/JioSaavn/__asyncrequests.py index 7ce3435..7a07c27 100644 --- a/JioSaavn/__asyncrequests.py +++ b/JioSaavn/__asyncrequests.py @@ -19,26 +19,3 @@ async def getText(url:str,data=None): return await response.text() -async def getSongId(url:str): - response = await getText(url,data=[('bitrate', '320')]) - try: - return response.split('"song":{"type":"')[1].split('","image":')[0].split('"id":"')[-1] - except IndexError: - return(response.split('"pid":"'))[1].split('","')[0] - - -async def getAlbumId(url:str): - response = await getText(url) - try: - return response.split('"album_id":"')[1].split('"')[0] - except IndexError: - return response.split('"page_id","')[1].split('","')[0] - - -async def getPlaylistId(url:str): - response = await getText(url) - try: - return response.split('"type":"playlist","id":"')[1].split('"')[0] - except IndexError: - return response.split('"page_id","')[1].split('","')[0] - diff --git a/JioSaavn/__helper.py b/JioSaavn/__helper.py index f5eaeef..01c43d8 100644 --- a/JioSaavn/__helper.py +++ b/JioSaavn/__helper.py @@ -15,3 +15,23 @@ def makeDifferentQualityImages(image:str): "500x500": f'{image}-500x500.jpg',} +def getSongId(response:str): + try: + return response.split('"song":{"type":"')[1].split('","image":')[0].split('"id":"')[-1] + except IndexError: + return(response.split('"pid":"'))[1].split('","')[0] + + +def getAlbumId(response:str): + try: + return response.split('"album_id":"')[1].split('"')[0] + except IndexError: + return response.split('"page_id","')[1].split('","')[0] + + +def getPlaylistId(response:str): + try: + return response.split('"type":"playlist","id":"')[1].split('"')[0] + except IndexError: + return response.split('"page_id","')[1].split('","')[0] + diff --git a/JioSaavn/__init__.py b/JioSaavn/__init__.py index d61ac98..8593996 100644 --- a/JioSaavn/__init__.py +++ b/JioSaavn/__init__.py @@ -1,15 +1,19 @@ -# from .__asyncJioSaavn import JioSaavn +from . import Async, Sync +from .Sync import JioSaavn,searchSong,searchAlbum,song,album,playlist,lyrics __version__ = 'v0.0.4' -__title__ = "JioSaavn" -__description__ = "JioSaavn Api for Python 3." +__title__ = "jiosaavn" +__description__ = "Search for JioSaavn songs & album. Get song ,album, lyric & playlist information from url or id." -# __all__ =[ -# 'searchSong', -# 'searchAlbum', -# 'song', -# 'album', -# 'lyrics', -# 'playlist', -# ] +__all__ =[ + 'JioSaavn', + 'Async', + 'Sync', + 'searchSong', + 'searchAlbum', + 'song', + 'album', + 'lyrics', + 'playlist', +] diff --git a/JioSaavn/__syncJioSaavn.py b/JioSaavn/__syncJioSaavn.py new file mode 100644 index 0000000..9a7886e --- /dev/null +++ b/JioSaavn/__syncJioSaavn.py @@ -0,0 +1,137 @@ + +from typing import Optional +from . import _syncFetch + +class JioSaavn: + ''' + ### Create an instance of JioSaavn with sync methods. + ''' + @staticmethod + def searchSong(query:str,page:int=1,limit:int=10,response:str='json'): + '''Searches for song in JioSaavn. + + Args: + query (str): Sets the search query. + page (int, optional): Sets page to the number of page. Defaults to 1. + limit (int, optional): Sets limit to the number of results. Defaults to 10. Max to 30. + response(str,optional): Sets the response of result. Defaults to `json`. + + Note: + To get raw result Set `response` to `raw` + + Example: + Calling `searchSong` method gives the search result of songs. + >>> from jiosaavn.Sync import jioSaavn + >>> search = jioSaavn.searchSong('alone') + >>> print(search) + + ''' + return _syncFetch.searchSong(query=query,page=page,limit=limit,response=response) + + @staticmethod + def searchAlbum(query:str,response:str='json'): + '''Searches for album in JioSaavn. + + Args: + query (str): Sets the search query. + response(str,optional): Sets the response of result. Defaults to `json`. + + Note: + To get raw result Set `response` to `raw` + + Examples: + Calling `searchAlbum` method gives the search result of albums. + >>> from jiosaavn.Sync import jioSaavn + >>> search = jioSaavn.searchAlbum('Alone') + >>> print(search) + + ''' + return _syncFetch.searchAlbum(query=query,response=response) + + @staticmethod + def song(url:Optional[str]=None,id:Optional[str]=None,lyrics:bool=False,response:str='json'): + '''Get song info from JioSaavn. + + Args: + url (str): Sets the url of song. + id (str): Sets the id of song. + lyrics (bool): Sets the lyrics whether to get lyrics. Defaults to `False`. + response(str,optional): Sets the response of result. Defaults to `json`. + + Note: + To get raw result Set `response` to `raw` + + Examples: + Calling `song` method gives the song info. + >>> from jiosaavn.Sync import jioSaavn + >>> result = jioSaavn.song(id='veJXEDAz') + >>> print(result) + + ''' + return _syncFetch.song(url=url,id=id,lyrics=lyrics,response=response) + + @staticmethod + def album(url:Optional[str]=None,id:Optional[str]=None,lyrics:bool=False,response:str='json'): + '''Get album info from JioSaavn. + + Args: + url (str): Sets the url of album. + id (str): Sets the id of album. + lyrics (bool): Sets the lyrics whether to get lyrics. Defaults to `False`. + response(str,optional): Sets the response of result. Defaults to `json`. + + Note: + To get raw result Set `response` to `raw` + + Examples: + Calling `album` method gives the album info. + >>> from jiosaavn.Sync import jioSaavn + >>> result = jioSaavn.album(id='10496527') + >>> print(result) + + ''' + return _syncFetch.album(url=url,id=id,lyrics=lyrics,response=response) + + @staticmethod + def playlist(url:Optional[str]=None,id:Optional[str]=None,lyrics:bool=False,response:str='json'): + '''Get playlist info from JioSaavn. + + Args: + url (str): Sets the url of playlist. + id (str): Sets the id of playlist. + lyrics (bool): Sets the lyrics whether to get lyrics. Defaults to `False`. + response(str,optional): Sets the response of result. Defaults to `json`. + + Note: + To get raw result Set `response` to `raw` + + Examples: + Calling `playlist` method gives the playlist info. + >>> from jiosaavn.Sync import jioSaavn + >>> result = jioSaavn.playlist(url='https://www.jiosaavn.com/s/playlist/88063878238ad9a391a33c0e628d2b01/90s_Love/OykxHSA0YytFo9wdEAzFBA__') + >>> print(result) + + ''' + return _syncFetch.playlist(url=url,id=id,lyrics=lyrics,response=response) + + @staticmethod + def lyrics(url:Optional[str]=None,id:Optional[str]=None,response:str='json'): + '''Get lyrics of a song (If Available) + + Args: + url (str): Sets the url of playlist. + id (str): Sets the id of song. + response(str,optional): Sets the response of result. Defaults to `json`. + + Note: + To get raw result Set `response` to `raw` + + Examples: + Calling `lyrics` method gives the lyrics of song. + >>> from jiosaavn.Sync import jioSaavn + >>> result = jioSaavn.lyrics(id='blMuXL1P') + >>> print(result) + + ''' + return _syncFetch.lyrics(url=url,id=id,response=response) + diff --git a/JioSaavn/__syncparse.py b/JioSaavn/__syncparse.py new file mode 100644 index 0000000..9132fee --- /dev/null +++ b/JioSaavn/__syncparse.py @@ -0,0 +1,91 @@ + +from . import __helper +from . import _asyncFetch + +def makeSongResponse(song,lyrics:bool=False): + return { + 'id': song['id'], + 'songName':song['song'], + 'albumName':song['album'], + 'albumId': song['albumid'], + 'playCount': song['play_count'], + 'duration': song['duration'], + 'label': song['label'], + 'primaryArtists': song['primary_artists'], + 'primaryArtistsId':song['primary_artists_id'], + 'featuredArtists': song['featured_artists'], + 'featuredArtistsId':song['featured_artists_id'], + # 'primaryArtists': [{'artist':artist,'id':id} for artist,id in zip((song['primary_artists']).split(', '),(song['primary_artists_id']).split(', '))], + # 'featuredArtists': [{'artist':artist,'id':id} for artist,id in zip((song['featured_artists']).split(', '),(song['featured_artists_id']).split(', '))], + 'singers': song['singers'], + 'starring':song['starring'], + 'language': __helper.ucfirst(song['language']), + 'copyright': song['copyright_text'], + 'hasLyrics' : song['has_lyrics'], + 'lyrics': _asyncFetch.lyrics(song['id']) if song['has_lyrics'] == "true" and lyrics else None, + 'releaseDate': song['release_date'], + 'songUrl':song['perma_url'], + 'albumUrl': song['album_url'], + 'imagesUrls': __helper.makeDifferentQualityImages(song['image']), + 'audioUrls':__helper.makeDifferentQualityMediaUrls(song['media_preview_url']), + 'labelUrl':f"https://www.jiosaavn.com{song['label_url']}", + } + + +def makeSearchResponse(data): + return [{ + 'id':i['id'], + 'songName':i['title'], + 'albumId':i['more_info']['album_id'], + 'albumName':i['more_info']['album'], + 'playCount': i['play_count'], + 'imagesUrls':__helper.makeDifferentQualityImages(i['image']), + 'primaryArtists':i['more_info']['artistMap']['primary_artists'], + 'featuredArtists':i['more_info']['artistMap']['featured_artists'], + 'artists':i['more_info']['artistMap']['artists'], + 'description':i['header_desc'], + 'hasLyrics':i['more_info']['has_lyrics'], + 'language':__helper.ucfirst(i['language']), + 'songUrl':i['perma_url'], + 'albumUrl':i['more_info']['album_url'], + } for i in data['results']] + + +def makeAlbumSearchResponse(data): + return [{ + 'id': i['id'], + 'albumName': i['title'], + 'music': i['music'], + 'description': i['description'], + 'year': i['more_info']['year'], + 'language': __helper.ucfirst(i['more_info']['language']), + 'songIds':i['more_info']['song_pids'], + 'albumUrl': i['url'], + 'imagesUrls':__helper.makeDifferentQualityImages(i['image']), + }for i in data['albums']['data']] + + +def makeAlbumResponse(data,lyrics:bool=False): + return { + 'albumId': data['albumid'], + 'title': data['title'], + 'name': data['name'], + 'year': data['year'], + 'primaryArtists': (data['primary_artists']).split(', '), + 'image': data['image'], + 'songs':[makeSongResponse(song=song,lyrics=lyrics) for song in data['songs']], + 'songUrl': data['perma_url'], + 'releaseDate': data['release_date'], + } + + +def makePlaylistResponse(data,lyrics:bool=False): + return { + 'id': data['listid'], + 'listname': data['listname'], + 'username': data['username'], + 'listCount': data['list_count'], + 'playlistUrl': data['perma_url'], + 'image': data['image'], + 'songs':[makeSongResponse(song=song,lyrics=lyrics) for song in data['songs']], + } \ No newline at end of file diff --git a/JioSaavn/__syncrequests.py b/JioSaavn/__syncrequests.py index 7676a5f..bbd8a01 100644 --- a/JioSaavn/__syncrequests.py +++ b/JioSaavn/__syncrequests.py @@ -4,37 +4,13 @@ def getjSON(url:str): - response = requests.get(url=url,headers=getHeaders()).json() - assert response.status == 200,'ClientResponse 404' - return response + response = requests.get(url=url,headers=getHeaders()) + assert response.status_code == 200,'ClientResponse 404' + return response.json() def getText(url:str,data=None): - response = requests.get(url=url,headers=getHeaders(),params=data).text - assert response.status == 200,'ClientResponse 404' - return response - - -def getSongId(url:str): - response = getText(url,data=[('bitrate', '320')]) - try: - return response.split('"song":{"type":"')[1].split('","image":')[0].split('"id":"')[-1] - except IndexError: - return(response.split('"pid":"'))[1].split('","')[0] - - -def getAlbumId(url:str): - response = getText(url) - try: - return response.split('"album_id":"')[1].split('"')[0] - except IndexError: - return response.split('"page_id","')[1].split('","')[0] - - -def getPlaylistId(url:str): - response = getText(url) - try: - return response.split('"type":"playlist","id":"')[1].split('"')[0] - except IndexError: - return response.split('"page_id","')[1].split('","')[0] + response = requests.get(url=url,headers=getHeaders(),params=data) + assert response.status_code == 200,'ClientResponse 404' + return response.text diff --git a/JioSaavn/_asyncFetch.py b/JioSaavn/_asyncFetch.py index 9fb346f..c37e4f1 100644 --- a/JioSaavn/_asyncFetch.py +++ b/JioSaavn/_asyncFetch.py @@ -4,20 +4,13 @@ from . import __asyncrequests from . import __baseApiUrl -from . import __asyncparseResponse -from .__asyncrequests import getSongId ,getAlbumId,getPlaylistId +from . import __asyncparse +from .__asyncrequests import getText from .__exceptions import ValidationError,InvalidURL from .__validation import isAlbumUrl,isSongUrl,isPlaylistUrl from .__constants import Response +from .__helper import getSongId,getAlbumId,getPlaylistId -__all__ =[ - 'searchSong', - 'searchAlbum', - 'song', - 'album', - 'lyrics', - 'playlist', -] @validate_arguments @@ -35,62 +28,16 @@ async def searchSong(query:str,page:Annotated[int, Field(gt=0)]=1,limit:Annotate Examples: Calling `searchSong` function gives the search result. + >>> from jiosaavn.Async import searchSong >>> search = await searchSong('alone') >>> print(search) - [ - { - "id": "HgyjuLNF", - "title": "Alone Alone (From "Malli Modalaindi")", - "image": "https://c.saavncdn.com/156/Alone-Alone-From-Malli-Modalaindi--Telugu-2021-20210920131019-150x150.jpg", - "images": { - "50x50": "https://c.saavncdn.com/156/Alone-Alone-From-Malli-Modalaindi--Telugu-2021-20210920131019-50x50.jpg", - "150x150": "https://c.saavncdn.com/156/Alone-Alone-From-Malli-Modalaindi--Telugu-2021-20210920131019-150x150.jpg", - "500x500": "https://c.saavncdn.com/156/Alone-Alone-From-Malli-Modalaindi--Telugu-2021-20210920131019-500x500.jpg" - }, - "album": "Alone Alone (From "Malli Modalaindi")", - "description": "Alone Alone (From "Malli Modalaindi") - Sid Sriram, Anup Rubens", - "has_lyrics": "false", - "singers": [ - "Sid Sriram", - "Anup Rubens" - ], - "language": "Telugu", - "album_id": "29782034", - "url": { - "song": "https://www.jiosaavn.com/song/alone-alone-from-malli-modalaindi/OA8SWwF8eXU", - "album": "https://www.jiosaavn.com/album/alone-alone-from-malli-modalaindi/lLQ4oVnaTvM_" - }, - }, - { - "id": "veJXEDAz", - "title": "Alone", - "image": "https://c.saavncdn.com/743/Alone-Punjabi-2020-20200507184621-150x150.jpg", - "images": { - "50x50": "https://c.saavncdn.com/743/Alone-Punjabi-2020-20200507184621-50x50.jpg", - "150x150": "https://c.saavncdn.com/743/Alone-Punjabi-2020-20200507184621-150x150.jpg", - "500x500": "https://c.saavncdn.com/743/Alone-Punjabi-2020-20200507184621-500x500.jpg" - }, - "album": "Alone", - "description": "Alone - Raashi Sood", - "has_lyrics": "false", - "singers": [ - "Raashi Sood" - ], - "language": "Punjabi", - "album_id": "20256407", - "url": { - "song": "https://www.jiosaavn.com/song/alone/Bg0haTF0dkk", - "album": "https://www.jiosaavn.com/album/alone/,kQ0LrBIybc_" - }, - } - ] - + ''' assert response in Response,'response should be json or raw' result = await __asyncrequests.getjSON(url=__baseApiUrl.songsearchFromSTRING(query=query,p=page,n=limit)) if response == 'raw': return result - return await __asyncparseResponse.makeSearchResponse(data=result) + return await __asyncparse.makeSearchResponse(data=result) async def searchAlbum(query:str,response:str='json'): @@ -105,48 +52,16 @@ async def searchAlbum(query:str,response:str='json'): Examples: Calling `searchAlbum` function gives the search result. + >>> from jiosaavn.Async import searchAlbum >>> search = await searchAlbum('Alone') >>> print(search) - [ - { - "id": "29782034", - "title": "Alone Alone (From "Malli Modalaindi")", - "image": "https://c.saavncdn.com/156/Alone-Alone-From-Malli-Modalaindi--Telugu-2021-20210920131019-150x150.jpg", - "images": { - "50x50": "https://c.saavncdn.com/156/Alone-Alone-From-Malli-Modalaindi--Telugu-2021-20210920131019-50x50.jpg", - "150x150": "https://c.saavncdn.com/156/Alone-Alone-From-Malli-Modalaindi--Telugu-2021-20210920131019-150x150.jpg", - "500x500": "https://c.saavncdn.com/156/Alone-Alone-From-Malli-Modalaindi--Telugu-2021-20210920131019-500x500.jpg" - }, - "music": "Sid Sriram, Anup Rubens", - "description": "2021 · Telugu Album · Sid Sriram, Anup Rubens", - "year": "2021", - "language": "Telugu", - "url": "https://www.jiosaavn.com/album/alone-alone-from-malli-modalaindi/lLQ4oVnaTvM_", - "song": "HgyjuLNF", - }, - { - "id": "1215558", - "title": "Alone", - "image": "https://c.saavncdn.com/794/Alone-Hindi-2014-150x150.jpg", - "images": { - "50x50": "https://c.saavncdn.com/794/Alone-Hindi-2014-50x50.jpg", - "150x150": "https://c.saavncdn.com/794/Alone-Hindi-2014-150x150.jpg", - "500x500": "https://c.saavncdn.com/794/Alone-Hindi-2014-500x500.jpg" - }, - "music": "Ankit Tiwari", - "description": "2014 · Hindi Film · Ankit Tiwari", - "year": "2014", - "language": "Hindi", - "url": "https://www.jiosaavn.com/album/alone/MmI5C7Qd8xU_", - "song": "woZT1XKb, BW3ZjaVE, 30LGCvEo, IVnaw30E", - }, - ] + ''' assert response in Response,'response should be json or raw' result = await __asyncrequests.getjSON(__baseApiUrl.albumsearchFromSTRING(query=query)) if response == 'raw': return result - return await __asyncparseResponse.makeAlbumSearchResponse(data=result) + return await __asyncparse.makeAlbumSearchResponse(data=result) async def song(url:Optional[str]=None,id:Optional[str]=None,lyrics:bool=False,response:str='json'): @@ -163,56 +78,22 @@ async def song(url:Optional[str]=None,id:Optional[str]=None,lyrics:bool=False,re Examples: Calling `song` function gives the search result. + >>> from jiosaavn.Async import song >>> result = await song(id='veJXEDAz') >>> print(result) - { - "id": "veJXEDAz", - "song": "Alone", - "album": "Alone", - "year": "2020", - "primary_artists": [ - "Raashi Sood" - ], - "singers": [ - "Raashi Sood" - ], - "image": "https://c.saavncdn.com/743/Alone-Punjabi-2020-20200507184621-500x500.jpg", - "images": { - "50x50": "https://c.saavncdn.com/743/Alone-Punjabi-2020-20200507184621-50x50.jpg", - "150x150": "https://c.saavncdn.com/743/Alone-Punjabi-2020-20200507184621-150x150.jpg", - "500x500": "https://c.saavncdn.com/743/Alone-Punjabi-2020-20200507184621-500x500.jpg" - }, - "duration": "120", - "label": "Raashi Sood Music", - "albumid": "20256407", - "language": "Punjabi", - "copyright_text": "© 2020 Raashi Sood Music", - "has_lyrics": "false", - "lyrics": null, - "media_url": "https://aac.saavncdn.com/743/dc78d52426dff2c0bf8e755c4721c398_160.mp4", - "media_urls": { - "96_KBPS": "https://aac.saavncdn.com/743/dc78d52426dff2c0bf8e755c4721c398_96.mp4", - "160_KBPS": "https://aac.saavncdn.com/743/dc78d52426dff2c0bf8e755c4721c398_160.mp4", - "320_KBPS": "https://aac.saavncdn.com/743/dc78d52426dff2c0bf8e755c4721c398_320.mp4" - }, - "release_date": "2020-05-07", - "url": { - "song": "https://www.jiosaavn.com/song/alone/Bg0haTF0dkk", - "album": "https://www.jiosaavn.com/album/alone/,kQ0LrBIybc_" - }, - } + ''' if not (url or id): raise ValidationError('Please provide a url or id of a song') if url: if not isSongUrl(url=url): raise InvalidURL('Please provide a valid jiosaavn song url') - id = await getSongId(url=url) + id = getSongId(response= await getText(url=url,data=[('bitrate', '320')])) assert response in Response,'response should be json or raw' result = await __asyncrequests.getjSON(url=__baseApiUrl.songFromID(id=id)) if response == 'raw': return result - return await __asyncparseResponse.makeSongResponse(song=result[id],lyrics=lyrics) + return await __asyncparse.makeSongResponse(song=result[id],lyrics=lyrics) async def album(url:Optional[str]=None,id:Optional[str]=None,lyrics:bool=False,response:str='json'): @@ -229,150 +110,22 @@ async def album(url:Optional[str]=None,id:Optional[str]=None,lyrics:bool=False,r Examples: Calling `album` function gives the search result. + >>> from jiosaavn.Async import album >>> result = await album(id='10496527') >>> print(result) - { - "albumid": "10496527", - "title": "Baahubali 2 - The Conclusion", - "name": "Baahubali 2 - The Conclusion", - "year": "2017", - "primary_artists": [ - "M. M. Keeravani" - ], - "image": "https://c.saavncdn.com/271/Baahubali-2-The-Conclusion-Telugu-2017-150x150.jpg", - "songs": [ - { - "id": "blMuXL1P", - "song": "Saahore Baahubali", - "album": "Baahubali 2 - The Conclusion", - "year": "2017", - "primary_artists": [ - "Daler Mehndi", - "M. M. Keeravani", - "Mounima Ch" - ], - "singers": [ - "Daler Mehndi", - "M. M. Keeravani", - "Mounima Ch" - ], - "image": "https://c.saavncdn.com/271/Baahubali-2-The-Conclusion-Telugu-2017-500x500.jpg", - "images": { - "50x50": "https://c.saavncdn.com/271/Baahubali-2-The-Conclusion-Telugu-2017-50x50.jpg", - "150x150": "https://c.saavncdn.com/271/Baahubali-2-The-Conclusion-Telugu-2017-150x150.jpg", - "500x500": "https://c.saavncdn.com/271/Baahubali-2-The-Conclusion-Telugu-2017-500x500.jpg" - }, - "duration": "203", - "label": "Lahari Music", - "albumid": "10496527", - "language": "Telugu", - "copyright_text": "© 2017 Lahari Music", - "has_lyrics": "true", - "lyrics": null, - "media_url": "https://aac.saavncdn.com/271/22dda6f74d38544c0b0d27d65ddddac1_160.mp4", - "media_urls": { - "96_KBPS": "https://aac.saavncdn.com/271/22dda6f74d38544c0b0d27d65ddddac1_96.mp4", - "160_KBPS": "https://aac.saavncdn.com/271/22dda6f74d38544c0b0d27d65ddddac1_160.mp4", - "320_KBPS": "https://aac.saavncdn.com/271/22dda6f74d38544c0b0d27d65ddddac1_320.mp4" - }, - "release_date": "2017-03-26", - "url": { - "song": "https://www.jiosaavn.com/song/saahore-baahubali/EgQmRCx8BmM", - "album": "https://www.jiosaavn.com/album/baahubali-2---the-conclusion/Vm5jaOSkM7E_" - }, - }, - { - "id": "XvwEmXL_", - "song": "Hamsa Naava", - "album": "Baahubali 2 - The Conclusion", - "year": "2017", - "primary_artists": [ - "Sony", - "Deepu" - ], - "singers": [ - "Sony", - "Deepu" - ], - "image": "https://c.saavncdn.com/271/Baahubali-2-The-Conclusion-Telugu-2017-500x500.jpg", - "images": { - "50x50": "https://c.saavncdn.com/271/Baahubali-2-The-Conclusion-Telugu-2017-50x50.jpg", - "150x150": "https://c.saavncdn.com/271/Baahubali-2-The-Conclusion-Telugu-2017-150x150.jpg", - "500x500": "https://c.saavncdn.com/271/Baahubali-2-The-Conclusion-Telugu-2017-500x500.jpg" - }, - "duration": "204", - "label": "Lahari Music", - "albumid": "10496527", - "language": "Telugu", - "copyright_text": "© 2017 Lahari Music", - "has_lyrics": "true", - "lyrics": null, - "media_url": "https://aac.saavncdn.com/271/5d651eeaa54b93af16a7c39999615f2d_160.mp4", - "media_urls": { - "96_KBPS": "https://aac.saavncdn.com/271/5d651eeaa54b93af16a7c39999615f2d_96.mp4", - "160_KBPS": "https://aac.saavncdn.com/271/5d651eeaa54b93af16a7c39999615f2d_160.mp4", - "320_KBPS": "https://aac.saavncdn.com/271/5d651eeaa54b93af16a7c39999615f2d_320.mp4" - }, - "release_date": "2017-03-26", - "url": { - "song": "https://www.jiosaavn.com/song/hamsa-naava/KB4cdBloe2w", - "album": "https://www.jiosaavn.com/album/baahubali-2---the-conclusion/Vm5jaOSkM7E_" - }, - }, - { - "id": "M3D7qn6T", - "song": "Kannaa Nidurinchara", - "album": "Baahubali 2 - The Conclusion", - "year": "2017", - "primary_artists": [ - "Sreenidhi Tirumala", - "V. Srisoumya" - ], - "singers": [ - "Sreenidhi Tirumala", - "V. Srisoumya" - ], - "image": "https://c.saavncdn.com/271/Baahubali-2-The-Conclusion-Telugu-2017-500x500.jpg", - "images": { - "50x50": "https://c.saavncdn.com/271/Baahubali-2-The-Conclusion-Telugu-2017-50x50.jpg", - "150x150": "https://c.saavncdn.com/271/Baahubali-2-The-Conclusion-Telugu-2017-150x150.jpg", - "500x500": "https://c.saavncdn.com/271/Baahubali-2-The-Conclusion-Telugu-2017-500x500.jpg" - }, - "duration": "291", - "label": "Lahari Music", - "albumid": "10496527", - "language": "Telugu", - "copyright_text": "© 2017 Lahari Music", - "has_lyrics": "true", - "lyrics": null, - "media_url": "https://aac.saavncdn.com/271/5e4fe5350641ff6c285d79676a483222_160.mp4", - "media_urls": { - "96_KBPS": "https://aac.saavncdn.com/271/5e4fe5350641ff6c285d79676a483222_96.mp4", - "160_KBPS": "https://aac.saavncdn.com/271/5e4fe5350641ff6c285d79676a483222_160.mp4", - "320_KBPS": "https://aac.saavncdn.com/271/5e4fe5350641ff6c285d79676a483222_320.mp4" - }, - "release_date": "2017-03-26", - "url": { - "song": "https://www.jiosaavn.com/song/kannaa-nidurinchara/PVsvBgVeAWc", - "album": "https://www.jiosaavn.com/album/baahubali-2---the-conclusion/Vm5jaOSkM7E_" - }, - }, - ], - "perma_url": "https://www.jiosaavn.com/album/baahubali-2---the-conclusion/Vm5jaOSkM7E_", - "release_date": "2017-03-26" - } + ''' if not (url or id): raise ValidationError('Please provide a url or id of an album') if url: if not isAlbumUrl(url=url): raise InvalidURL('Please provide a valid jiosaavn album url') - id = await getAlbumId(url) + id = getAlbumId(await getText(url=url)) assert response in Response,'response should be json or raw' result = await __asyncrequests.getjSON(__baseApiUrl.albumFromID(id=id)) if response == 'raw': return result - return await __asyncparseResponse.makeAlbumResponse(data=result,lyrics=lyrics) + return await __asyncparse.makeAlbumResponse(data=result,lyrics=lyrics) async def playlist(url:Optional[str]=None,id:Optional[str]=None,lyrics:bool=False,response:str='json'): @@ -389,149 +142,22 @@ async def playlist(url:Optional[str]=None,id:Optional[str]=None,lyrics:bool=Fals Examples: Calling `playlist` function gives the search result. + >>> from jiosaavn.Async import playlist >>> result = await playlist(url='https://www.jiosaavn.com/s/playlist/88063878238ad9a391a33c0e628d2b01/90s_Love/OykxHSA0YytFo9wdEAzFBA__') >>> print(result) - { - "listid": "268477478", - "title": "90's Love", - "username": "", - "list_count": "17", - "uid": "88063878238ad9a391a33c0e628d2b01", - "perma_url": "https://www.jiosaavn.com/s/playlist/88063878238ad9a391a33c0e628d2b01/90s_Love/OykxHSA0YytFo9wdEAzFBA__", - "image": "https://pli.saavncdn.com/74/78/268477478.jpg?bch=1555760417", - "songs": [ - { - "id": "2XLkr2Gd", - "song": "Kal Ho Naa Ho", - "album": "Kal Ho Naa Ho (Original Motion Picture Soundtrack)", - "year": "2003", - "primary_artists": [ - "Shankar-Ehsaan-Loy", - "Sonu Nigam" - ], - "singers": [ - "Shankar-Ehsaan-Loy", - "Sonu Nigam" - ], - "image": "https://c.saavncdn.com/909/Kal-Ho-Naa-Ho-Hindi-2003-500x500.jpg", - "images": { - "50x50": "https://c.saavncdn.com/909/Kal-Ho-Naa-Ho-Hindi-2003-50x50.jpg", - "150x150": "https://c.saavncdn.com/909/Kal-Ho-Naa-Ho-Hindi-2003-150x150.jpg", - "500x500": "https://c.saavncdn.com/909/Kal-Ho-Naa-Ho-Hindi-2003-500x500.jpg" - }, - "duration": "321", - "label": "Sony Music Entertainment India Pvt. Ltd.", - "albumid": "1208084", - "language": "Hindi", - "copyright_text": "(P) 2003 Sony Music Entertainment India Pvt. Ltd.", - "has_lyrics": "false", - "lyrics": null, - "media_url": "https://aac.saavncdn.com/909/b34c95486eb42ede300a549da19a38ad_160.mp4", - "media_urls": { - "96_KBPS": "https://aac.saavncdn.com/909/b34c95486eb42ede300a549da19a38ad_96.mp4", - "160_KBPS": "https://aac.saavncdn.com/909/b34c95486eb42ede300a549da19a38ad_160.mp4", - "320_KBPS": "https://aac.saavncdn.com/909/b34c95486eb42ede300a549da19a38ad_320.mp4" - }, - "release_date": "2003-09-20", - "url": { - "song": "https://www.jiosaavn.com/song/kal-ho-naa-ho/QjAnWgYCcFc", - "album": "https://www.jiosaavn.com/album/kal-ho-naa-ho-original-motion-picture-soundtrack/wxleSiR74Dg_" - } - }, - { - "id": "lULDgPcz", - "song": "Main Hoon Na", - "album": "Main Hoon Na", - "year": "2004", - "primary_artists": [ - "Sonu Nigam", - "Shreya Ghoshal" - ], - "singers": [ - "Sonu Nigam", - "Shreya Ghoshal" - ], - "image": "https://c.saavncdn.com/388/Main-Hoon-Na-Hindi-2004-500x500.jpg", - "images": { - "50x50": "https://c.saavncdn.com/388/Main-Hoon-Na-Hindi-2004-50x50.jpg", - "150x150": "https://c.saavncdn.com/388/Main-Hoon-Na-Hindi-2004-150x150.jpg", - "500x500": "https://c.saavncdn.com/388/Main-Hoon-Na-Hindi-2004-500x500.jpg" - }, - "duration": "361", - "label": "", - "albumid": "1037222", - "language": "Hindi", - "copyright_text": "© 2004 ", - "has_lyrics": "true", - "lyrics": null, - "media_url": "https://aac.saavncdn.com/388/348841a9282b5b362526a8098a7f4491_160.mp4", - "media_urls": { - "96_KBPS": "https://aac.saavncdn.com/388/348841a9282b5b362526a8098a7f4491_96.mp4", - "160_KBPS": "https://aac.saavncdn.com/388/348841a9282b5b362526a8098a7f4491_160.mp4", - "320_KBPS": "https://aac.saavncdn.com/388/348841a9282b5b362526a8098a7f4491_320.mp4" - }, - "release_date": "2004-02-27", - "url": { - "song": "https://www.jiosaavn.com/song/main-hoon-na/HD0ndRNgVEk", - "album": "https://www.jiosaavn.com/album/main-hoon-na/Gf2uDkAyAkg_" - } - }, - { - "id": "jFerJMnc", - "song": "Koi Mil Gaya", - "album": "Kuch Kuch Hota Hai (Original Motion Picture Soundtrack)", - "year": "1998", - "primary_artists": [ - "Jatin-Lalit", - "Kavita Krishnamurthy", - "Udit Narayan", - "Alka Yagnik" - ], - "singers": [ - "Jatin-Lalit", - "Kavita Krishnamurthy", - "Udit Narayan", - "Alka Yagnik" - ], - "image": "https://c.saavncdn.com/907/Kuch-Kuch-Hota-Hai-Hindi-1998-20190516130035-500x500.jpg", - "images": { - "50x50": "https://c.saavncdn.com/907/Kuch-Kuch-Hota-Hai-Hindi-1998-20190516130035-50x50.jpg", - "150x150": "https://c.saavncdn.com/907/Kuch-Kuch-Hota-Hai-Hindi-1998-20190516130035-150x150.jpg", - "500x500": "https://c.saavncdn.com/907/Kuch-Kuch-Hota-Hai-Hindi-1998-20190516130035-500x500.jpg" - }, - "duration": "437", - "label": "Sony Music Entertainment India Pvt. Ltd.", - "albumid": "1035265", - "language": "Hindi", - "copyright_text": "(P) 1998 Sony Music Entertainment India Pvt. Ltd.", - "has_lyrics": "false", - "lyrics": null, - "media_url": "https://aac.saavncdn.com/907/2d22f49ec5435c9d606742ae2648a5a2_160.mp4", - "media_urls": { - "96_KBPS": "https://aac.saavncdn.com/907/2d22f49ec5435c9d606742ae2648a5a2_96.mp4", - "160_KBPS": "https://aac.saavncdn.com/907/2d22f49ec5435c9d606742ae2648a5a2_160.mp4", - "320_KBPS": "https://aac.saavncdn.com/907/2d22f49ec5435c9d606742ae2648a5a2_320.mp4" - }, - "release_date": "1998-08-19", - "url": { - "song": "https://www.jiosaavn.com/song/koi-mil-gaya/Gi4OQz59WVA", - "album": "https://www.jiosaavn.com/album/kuch-kuch-hota-hai-original-motion-picture-soundtrack/zvqnBMKjQeM_" - } - }, - ] - } + ''' if not (url or id): raise ValidationError('Please provide a url or id of playlist') if url: if not isPlaylistUrl(url=url): raise InvalidURL('Please provide a valid jiosaavn playlist url') - id = await getPlaylistId(url) + id = getPlaylistId(await getText(url=url)) assert response in Response,'response should be json or raw' result = await __asyncrequests.getjSON(url=__baseApiUrl.playlistFromID(id=id)) if response == 'raw': return result - return await __asyncparseResponse.makePlaylistResponse(data=result ,lyrics=lyrics) + return await __asyncparse.makePlaylistResponse(data=result ,lyrics=lyrics) async def lyrics(url:Optional[str]=None,id:Optional[str]=None,response:str='json'): @@ -547,20 +173,17 @@ async def lyrics(url:Optional[str]=None,id:Optional[str]=None,response:str='json Examples: Calling `lyrics` function gives the search result. + >>> from jiosaavn.Async import lyrics >>> result = await lyrics(id='blMuXL1P') >>> print(result) - { - "lyrics": "bhali bhali bhalira bhali
sahore bahubali
bhali bhali bhalira bhali
sahore bahubali
jayaarti nike pattali pattali
bhuvanalanni jai kottali
gaganale chhatra pattali

haiss rudrass haisarbhadra samudrass
haiss rudrass haisarbhadra samudrass
haiss rudrass haisarbhadra samudrass
haiss rudrass haisarbhadra samudrass

aa janani deeksha achalam
i koduke kavachan
ippuda ammaki amm ainanduka
pulkarinchindiga i kshana

aduulu guttal mittal gaminch
pidikit pidugul patti minch
arikul vargal durgal jayinch
avaniki swarganne dinch

ant maha baludina amm ori pasiwade
shivudaina bhavudaina ammaku sat kadantade

haiss rudrass haisarbhadra samudrass
haiss rudrass haisarbhadra samudrass
haiss rudrass haiss rudrass
haisarbhadra samudrass haisarbhadra samudrass
haiss rudrass haisarbhadra samudrass
haiss rudrass haisarbhadra samudrass
haiss rudrass haisarbhadra samudrass
haiss rudrass haisarbhadra samudrass
haiss rudrass haisarbhadra samudrass

bhali bhali bhalira bhali
sahore bahubali
jayaarti nike pattali
bhali bhali bhalira bhali
sahore bahubali
jayaarti nike pattali pattali
bhuvanalanni jai kottali
gaganale chhatra pattali", - "lyrics_copyright": "Writer(s): M. M. Keeravaani, Shiva Shakthi Datta, K. Ramakrishna Lyrics powered by www.musixmatch.com", - "snippet": "haiss rudrass haisarbhadra samudrass" - } + ''' if not (url or id): raise ValidationError('Please provide a url or id of a song') if url: if not isSongUrl(url=url): raise InvalidURL('Please provide a valid jiosaavn song url') - id = await getSongId(url=url) + id = getSongId(response= await getText(url=url,data=[('bitrate', '320')])) assert response in Response,'response should be json or raw' result = await __asyncrequests.getjSON(__baseApiUrl.lyricsFromID(id=id)) if response == 'raw': diff --git a/JioSaavn/_syncFetch.py b/JioSaavn/_syncFetch.py new file mode 100644 index 0000000..b5a2bcb --- /dev/null +++ b/JioSaavn/_syncFetch.py @@ -0,0 +1,196 @@ +from typing import Optional +from pydantic import validate_arguments, Field +from pydantic.typing import Annotated + +from . import __syncrequests +from . import __baseApiUrl +from . import __syncparse +from .__syncrequests import getText +from .__exceptions import ValidationError,InvalidURL +from .__validation import isAlbumUrl,isSongUrl,isPlaylistUrl +from .__constants import Response +from .__helper import getSongId,getAlbumId,getPlaylistId + + + +@validate_arguments +def searchSong(query:str,page:Annotated[int, Field(gt=0)]=1,limit:Annotated[int, Field(gt=0,lt=30)]=10,response:str='json'): + '''Searches for song in JioSaavn. + + Args: + query (str): Sets the search query. + page (int, optional): Sets page to the number of page. Defaults to 1. + limit (int, optional): Sets limit to the number of results. Defaults to 10. Max to 30. + response(str,optional): Sets the response of result. Defaults to `json`. + + Note: + To get raw result Set `response` to `raw` + + Examples: + Calling `searchSong` function gives the search result. + >>> from jiosaavn.Sync import searchSong + >>> search = searchSong('alone') + >>> print(search) + + ''' + assert response in Response,'response should be json or raw' + result = __syncrequests.getjSON(url=__baseApiUrl.songsearchFromSTRING(query=query,p=page,n=limit)) + if response == 'raw': + return result + return __syncparse.makeSearchResponse(data=result) + + +def searchAlbum(query:str,response:str='json'): + '''Searches for album in JioSaavn. + + Args: + query (str): Sets the search query. + response(str,optional): Sets the response of result. Defaults to `json`. + + Note: + To get raw result Set `response` to `raw` + + Examples: + Calling `searchAlbum` function gives the search result. + >>> from jiosaavn.Sync import searchAlbum + >>> search = searchAlbum('Alone') + >>> print(search) + + ''' + assert response in Response,'response should be json or raw' + result = __syncrequests.getjSON(__baseApiUrl.albumsearchFromSTRING(query=query)) + if response == 'raw': + return result + return __syncparse.makeAlbumSearchResponse(data=result) + + +def song(url:Optional[str]=None,id:Optional[str]=None,lyrics:bool=False,response:str='json'): + '''Get song info from JioSaavn. + + Args: + url (str): Sets the url of song. + id (str): Sets the id of song. + lyrics (bool): Sets the lyrics whether to get lyrics. Defaults to `False`. + response(str,optional): Sets the response of result. Defaults to `json`. + + Note: + To get raw result Set `response` to `raw` + + Examples: + Calling `song` function gives the search result. + >>> from jiosaavn.Sync import song + >>> result = song(id='veJXEDAz') + >>> print(result) + + ''' + if not (url or id): + raise ValidationError('Please provide a url or id of a song') + if url: + if not isSongUrl(url=url): + raise InvalidURL('Please provide a valid jiosaavn song url') + id = getSongId(response= getText(url=url,data=[('bitrate', '320')])) + assert response in Response,'response should be json or raw' + result = __syncrequests.getjSON(url=__baseApiUrl.songFromID(id=id)) + if response == 'raw': + return result + return __syncparse.makeSongResponse(song=result[id],lyrics=lyrics) + + +def album(url:Optional[str]=None,id:Optional[str]=None,lyrics:bool=False,response:str='json'): + '''Get album info from JioSaavn. + + Args: + url (str): Sets the url of album. + id (str): Sets the id of album. + lyrics (bool): Sets the lyrics whether to get lyrics. Defaults to `False`. + response(str,optional): Sets the response of result. Defaults to `json`. + + Note: + To get raw result Set `response` to `raw` + + Examples: + Calling `album` function gives the search result. + >>> from jiosaavn.Sync import album + >>> result = album(id='10496527') + >>> print(result) + + ''' + if not (url or id): + raise ValidationError('Please provide a url or id of an album') + if url: + if not isAlbumUrl(url=url): + raise InvalidURL('Please provide a valid jiosaavn album url') + id = getAlbumId(getText(url=url)) + assert response in Response,'response should be json or raw' + result = __syncrequests.getjSON(__baseApiUrl.albumFromID(id=id)) + if response == 'raw': + return result + return __syncparse.makeAlbumResponse(data=result,lyrics=lyrics) + + +def playlist(url:Optional[str]=None,id:Optional[str]=None,lyrics:bool=False,response:str='json'): + '''Get playlist info from JioSaavn. + + Args: + url (str): Sets the url of playlist. + id (str): Sets the id of playlist. + lyrics (bool): Sets the lyrics whether to get lyrics. Defaults to `False`. + response(str,optional): Sets the response of result. Defaults to `json`. + + Note: + To get raw result Set `response` to `raw` + + Examples: + Calling `playlist` function gives the search result. + >>> from jiosaavn.Sync import playlist + >>> result = playlist(url='https://www.jiosaavn.com/s/playlist/88063878238ad9a391a33c0e628d2b01/90s_Love/OykxHSA0YytFo9wdEAzFBA__') + >>> print(result) + + ''' + if not (url or id): + raise ValidationError('Please provide a url or id of playlist') + if url: + if not isPlaylistUrl(url=url): + raise InvalidURL('Please provide a valid jiosaavn playlist url') + id = getPlaylistId(getText(url=url)) + assert response in Response,'response should be json or raw' + result = __syncrequests.getjSON(url=__baseApiUrl.playlistFromID(id=id)) + if response == 'raw': + return result + return __syncparse.makePlaylistResponse(data=result ,lyrics=lyrics) + + +def lyrics(url:Optional[str]=None,id:Optional[str]=None,response:str='json'): + '''Get lyrics of a song (If Available) + + Args: + url (str): Sets the url of playlist. + id (str): Sets the id of song. + response(str,optional): Sets the response of result. Defaults to `json`. + + Note: + To get raw result Set `response` to `raw` + + Examples: + Calling `lyrics` function gives the search result. + >>> from jiosaavn.Sync import lyrics + >>> result = lyrics(id='blMuXL1P') + >>> print(result) + + ''' + if not (url or id): + raise ValidationError('Please provide a url or id of a song') + if url: + if not isSongUrl(url=url): + raise InvalidURL('Please provide a valid jiosaavn song url') + id = getSongId(response= getText(url=url,data=[('bitrate', '320')])) + assert response in Response,'response should be json or raw' + result = __syncrequests.getjSON(__baseApiUrl.lyricsFromID(id=id)) + if response == 'raw': + return result + if result.get('status' ) == "failure": + return {'status': f'no lyric'} + return {'lyrics':result.get('lyrics'), + 'lyrics_copyright':result.get('lyrics_copyright'), + 'snippet':result.get('snippet') + } \ No newline at end of file diff --git a/README.md b/README.md index 1b96fdd..56b5aa8 100644 --- a/README.md +++ b/README.md @@ -5,68 +5,1117 @@ ## Installing ```bash -pip3 install JioSaavn +pip3 install jiosaavn ``` -## Async +## Async and Sync Functions +```python +from jiosaavn.Async import JioSaavn,searchSong,searchAlbum,song,album,playlist,lyrics +from jiosaavn.Sync import JioSaavn,searchSong,searchAlbum,song,album,playlist,lyrics +``` #### Search for only songs ```python -from JioSaavn import searchSong +# Async +from jiosaavn.Async import searchSong search = await searchSong('alone') print(search) + +# Sync +from jiosaavn.Sync import searchSong +search = searchSong('alone') +print(search) ```
Example Result ```json [ - { - "id": "HgyjuLNF", - "title": "Alone Alone (From "Malli Modalaindi")", - "image": "https://c.saavncdn.com/156/Alone-Alone-From-Malli-Modalaindi--Telugu-2021-20210920131019-150x150.jpg", - "images": { - "50x50": "https://c.saavncdn.com/156/Alone-Alone-From-Malli-Modalaindi--Telugu-2021-20210920131019-50x50.jpg", - "150x150": "https://c.saavncdn.com/156 Alone-Alone-From-Malli-Modalaindi--Telugu-2021-20210920131019-150x150.jpg", - "500x500": "https://c.saavncdn.com/156/Alone-Alone-From-Malli-Modalaindi--Telugu-2021-20210920131019-500x500.jpg" - }, - "album": "Alone Alone (From "Malli Modalaindi")", - "description": "Alone Alone (From "Malli Modalaindi") - Sid Sriram, Anup Rubens", - "has_lyrics": "false", - "singers": [ - "Sid Sriram", - "Anup Rubens" - ], - "language": "Telugu", - "album_id": "29782034", - "url": { - "song": "https://www.jiosaavn.com/song/alone-alone-from-malli-modalaindi/OA8SWwF8eXU", - "album": "https://www.jiosaavn.com/album/alone-alone-from-malli-modalaindi/lLQ4oVnaTvM_" - }, + { + "id": "mlOelmXY", + "songName": "Alone", + "albumId": "10149322", + "albumName": "Alone", + "playCount": "49207056", + "imagesUrls": { + "50x50": "http://c.saavncdn.com/522/Alone-English-2017-20180131085202-50x50.jpg", + "150x150": "http://c.saavncdn.com/522/Alone-English-2017-20180131085202-150x150.jpg", + "500x500": "http://c.saavncdn.com/522/Alone-English-2017-20180131085202-500x500.jpg" }, - { - "id": "veJXEDAz", - "title": "Alone", - "image": "https://c.saavncdn.com/743/Alone-Punjabi-2020-20200507184621-150x150.jpg", - "images": { - "50x50": "https://c.saavncdn.com/743/Alone-Punjabi-2020-20200507184621-50x50.jpg", - "150x150": "https://c.saavncdn.com/743/Alone-Punjabi-2020-20200507184621-150x150.jpg", - "500x500": "https://c.saavncdn.com/743/Alone-Punjabi-2020-20200507184621-500x500.jpg" - }, - "album": "Alone", - "description": "Alone - Raashi Sood", - "has_lyrics": "false", - "singers": [ - "Raashi Sood" - ], - "language": "Punjabi", - "album_id": "20256407", - "url": { - "song": "https://www.jiosaavn.com/song/alone/Bg0haTF0dkk", - "album": "https://www.jiosaavn.com/album/alone/,kQ0LrBIybc_" - }, - } + "primaryArtists": [ + { + "id": "1335467", + "name": "Alan Walker", + "role": "primary_artists", + "image": "https://c.saavncdn.com/artists/Alan_Walker_002_20190507112228_150x150.jpg", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/alan-walker-/wbWcxgUNzyo_" + } + ], + "featuredArtists": [], + "artists": [ + { + "id": "1335467", + "name": "Alan Walker", + "role": "music", + "image": "https://c.saavncdn.com/artists/Alan_Walker_002_20190507112228_150x150.jpg", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/alan-walker-/wbWcxgUNzyo_" + }, + { + "id": "822579", + "name": "Jesper Borgen", + "role": "music", + "image": "", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/jesper-borgen-/2odnY,ZN-jQ_" + }, + { + "id": "1425075", + "name": "Anders Frøen", + "role": "music", + "image": "", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/anders-froen-/Wj4QA5E85tc_" + }, + { + "id": "1625408", + "name": "Gunnar Greve", + "role": "music", + "image": "", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/gunnar-greve-/MYLcGokRN0w_" + }, + { + "id": "648765", + "name": "Jonnali Parmenius", + "role": "music", + "image": "", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/jonnali-parmenius-/C,kojV56,2A_" + }, + { + "id": "1335467", + "name": "Alan Walker", + "role": "singer", + "image": "https://c.saavncdn.com/artists/Alan_Walker_002_20190507112228_150x150.jpg", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/alan-walker-/wbWcxgUNzyo_" + }, + { + "id": "1335467", + "name": "Alan Walker", + "role": "lyricist", + "image": "https://c.saavncdn.com/artists/Alan_Walker_002_20190507112228_150x150.jpg", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/alan-walker-/wbWcxgUNzyo_" + }, + { + "id": "822579", + "name": "Jesper Borgen", + "role": "lyricist", + "image": "", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/jesper-borgen-/2odnY,ZN-jQ_" + }, + { + "id": "1425075", + "name": "Anders Frøen", + "role": "lyricist", + "image": "", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/anders-froen-/Wj4QA5E85tc_" + }, + { + "id": "1625408", + "name": "Gunnar Greve", + "role": "lyricist", + "image": "", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/gunnar-greve-/MYLcGokRN0w_" + }, + { + "id": "648765", + "name": "Jonnali Parmenius", + "role": "lyricist", + "image": "", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/jonnali-parmenius-/C,kojV56,2A_" + } + ], + "description": "Track from Alan Walker from album Alone.", + "hasLyrics": "false", + "language": "English", + "songUrl": "https://www.jiosaavn.com/song/alone/HQQkVBhdb2o", + "albumUrl": "https://www.jiosaavn.com/album/alone/RGziQ8ScK3g_" + }, + { + "id": "HgyjuLNF", + "songName": "Alone Alone (From "Malli Modalaindi")", + "albumId": "29782034", + "albumName": "Alone Alone (From "Malli Modalaindi")", + "playCount": "949200", + "imagesUrls": { + "50x50": "http://c.saavncdn.com/156/Alone-Alone-From-Malli-Modalaindi--Telugu-2021-20210920131019-50x50.jpg", + "150x150": "http://c.saavncdn.com/156/Alone-Alone-From-Malli-Modalaindi--Telugu-2021-20210920131019-150x150.jpg", + "500x500": "http://c.saavncdn.com/156/Alone-Alone-From-Malli-Modalaindi--Telugu-2021-20210920131019-500x500.jpg" + }, + "primaryArtists": [ + { + "id": "689580", + "name": "Sid Sriram", + "role": "primary_artists", + "image": "https://c.saavncdn.com/artists/Sid_Sriram_004_20200321102120_150x150.jpg", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/sid-sriram-/634AK8t6tAU_" + }, + { + "id": "684364", + "name": "Anup Rubens", + "role": "primary_artists", + "image": "https://c.saavncdn.com/artists/Anup_Rubens_002_20190905131837_150x150.jpg", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/anup-rubens-/JW5jvWu7Qr4_" + } + ], + "featuredArtists": [], + "artists": [ + { + "id": "689580", + "name": "Sid Sriram", + "role": "singer", + "image": "https://c.saavncdn.com/artists/Sid_Sriram_004_20200321102120_150x150.jpg", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/sid-sriram-/634AK8t6tAU_" + }, + { + "id": "684364", + "name": "Anup Rubens", + "role": "singer", + "image": "https://c.saavncdn.com/artists/Anup_Rubens_002_20190905131837_150x150.jpg", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/anup-rubens-/JW5jvWu7Qr4_" + }, + { + "id": "455242", + "name": "Krishna Chaitanya", + "role": "lyricist", + "image": "https://c.saavncdn.com/artists/Krishna_Chaitanya_150x150.jpg", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/krishna-chaitanya-/-hO9iJXocuw_" + }, + { + "id": "465174", + "name": "Sumanth", + "role": "starring", + "image": "https://c.saavncdn.com/artists/Sumanth_150x150.jpg", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/sumanth-/4x,JIbiqKm4_" + }, + { + "id": "2529284", + "name": "Naina Ganguly", + "role": "starring", + "image": "https://c.saavncdn.com/artists/Naina_Ganguly_150x150.jpg", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/naina-ganguly-/qHB7N4SD9Nk_" + } + ], + "description": "Track from Sid Sriram and Anup Rubens from album Alone Alone (From "Malli Modalaindi").", + "hasLyrics": "false", + "language": "Telugu", + "songUrl": "https://www.jiosaavn.com/song/alone-alone-from-malli-modalaindi/OA8SWwF8eXU", + "albumUrl": "https://www.jiosaavn.com/album/alone-alone-from-malli-modalaindi/lLQ4oVnaTvM_" + }, + { + "id": "t4-oIFZc", + "songName": "Alone", + "albumId": "2337820", + "albumName": "Alone", + "playCount": "6475644", + "imagesUrls": { + "50x50": "http://c.saavncdn.com/638/Alone-English-2016-50x50.jpg", + "150x150": "http://c.saavncdn.com/638/Alone-English-2016-150x150.jpg", + "500x500": "http://c.saavncdn.com/638/Alone-English-2016-500x500.jpg" + }, + "primaryArtists": [ + { + "id": "862454", + "name": "Marshmello", + "role": "primary_artists", + "image": "http://c.saavncdn.com/artists/Marshmello_20190123065408_150x150.jpg", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/marshmello/Eevs5FiVgus_" + } + ], + "featuredArtists": [], + "artists": [ + { + "id": "862454", + "name": "Marshmello", + "role": "singer", + "image": "http://c.saavncdn.com/artists/Marshmello_20190123065408_150x150.jpg", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/marshmello/Eevs5FiVgus_" + } + ], + "description": "Track from Marshmello from album Alone.", + "hasLyrics": "false", + "language": "English", + "songUrl": "https://www.jiosaavn.com/song/alone/BFxGXj12bVA", + "albumUrl": "https://www.jiosaavn.com/album/alone/nUiJOh,-0pY_" + }, + { + "id": "JV7dA4mV", + "songName": "Alone (Instrumental Remix)", + "albumId": "10149322", + "albumName": "Alone", + "playCount": "2937767", + "imagesUrls": { + "50x50": "http://c.saavncdn.com/522/Alone-English-2017-20180131085202-50x50.jpg", + "150x150": "http://c.saavncdn.com/522/Alone-English-2017-20180131085202-150x150.jpg", + "500x500": "http://c.saavncdn.com/522/Alone-English-2017-20180131085202-500x500.jpg" + }, + "primaryArtists": [ + { + "id": "1335467", + "name": "Alan Walker", + "role": "primary_artists", + "image": "https://c.saavncdn.com/artists/Alan_Walker_002_20190507112228_150x150.jpg", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/alan-walker-/wbWcxgUNzyo_" + } + ], + "featuredArtists": [], + "artists": [ + { + "id": "1335467", + "name": "Alan Walker", + "role": "music", + "image": "https://c.saavncdn.com/artists/Alan_Walker_002_20190507112228_150x150.jpg", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/alan-walker-/wbWcxgUNzyo_" + }, + { + "id": "648765", + "name": "Jonnali Parmenius", + "role": "music", + "image": "", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/jonnali-parmenius-/C,kojV56,2A_" + }, + { + "id": "1425075", + "name": "Anders Frøen", + "role": "music", + "image": "", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/anders-froen-/Wj4QA5E85tc_" + }, + { + "id": "822579", + "name": "Jesper Borgen", + "role": "music", + "image": "", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/jesper-borgen-/2odnY,ZN-jQ_" + }, + { + "id": "1625408", + "name": "Gunnar Greve", + "role": "music", + "image": "", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/gunnar-greve-/MYLcGokRN0w_" + }, + { + "id": "755154", + "name": "Noonie Bao", + "role": "music", + "image": "https://c.saavncdn.com/954/Sorry-Not-Sorry-English-2016-150x150.jpg", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/noonie-bao-/TlZufM7L6sQ_" + }, + { + "id": "1335467", + "name": "Alan Walker", + "role": "singer", + "image": "https://c.saavncdn.com/artists/Alan_Walker_002_20190507112228_150x150.jpg", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/alan-walker-/wbWcxgUNzyo_" + }, + { + "id": "1335467", + "name": "Alan Walker", + "role": "lyricist", + "image": "https://c.saavncdn.com/artists/Alan_Walker_002_20190507112228_150x150.jpg", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/alan-walker-/wbWcxgUNzyo_" + }, + { + "id": "648765", + "name": "Jonnali Parmenius", + "role": "lyricist", + "image": "", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/jonnali-parmenius-/C,kojV56,2A_" + }, + { + "id": "1425075", + "name": "Anders Frøen", + "role": "lyricist", + "image": "", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/anders-froen-/Wj4QA5E85tc_" + }, + { + "id": "822579", + "name": "Jesper Borgen", + "role": "lyricist", + "image": "", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/jesper-borgen-/2odnY,ZN-jQ_" + }, + { + "id": "1625408", + "name": "Gunnar Greve", + "role": "lyricist", + "image": "", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/gunnar-greve-/MYLcGokRN0w_" + }, + { + "id": "755154", + "name": "Noonie Bao", + "role": "lyricist", + "image": "https://c.saavncdn.com/954/Sorry-Not-Sorry-English-2016-150x150.jpg", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/noonie-bao-/TlZufM7L6sQ_" + } + ], + "description": "Track from Alan Walker from album Alone.", + "hasLyrics": "false", + "language": "Unknown", + "songUrl": "https://www.jiosaavn.com/song/alone-instrumental-remix/Oj5cVTUEWmU", + "albumUrl": "https://www.jiosaavn.com/album/alone/RGziQ8ScK3g_" + }, + { + "id": "4zBsiDyX", + "songName": "Alone (Restrung)", + "albumId": "10149322", + "albumName": "Alone", + "playCount": "2290141", + "imagesUrls": { + "50x50": "http://c.saavncdn.com/522/Alone-English-2017-20180131085202-50x50.jpg", + "150x150": "http://c.saavncdn.com/522/Alone-English-2017-20180131085202-150x150.jpg", + "500x500": "http://c.saavncdn.com/522/Alone-English-2017-20180131085202-500x500.jpg" + }, + "primaryArtists": [ + { + "id": "1335467", + "name": "Alan Walker", + "role": "primary_artists", + "image": "https://c.saavncdn.com/artists/Alan_Walker_002_20190507112228_150x150.jpg", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/alan-walker-/wbWcxgUNzyo_" + } + ], + "featuredArtists": [], + "artists": [ + { + "id": "1335467", + "name": "Alan Walker", + "role": "music", + "image": "https://c.saavncdn.com/artists/Alan_Walker_002_20190507112228_150x150.jpg", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/alan-walker-/wbWcxgUNzyo_" + }, + { + "id": "822579", + "name": "Jesper Borgen", + "role": "music", + "image": "", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/jesper-borgen-/2odnY,ZN-jQ_" + }, + { + "id": "1425075", + "name": "Anders Frøen", + "role": "music", + "image": "", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/anders-froen-/Wj4QA5E85tc_" + }, + { + "id": "1625408", + "name": "Gunnar Greve", + "role": "music", + "image": "", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/gunnar-greve-/MYLcGokRN0w_" + }, + { + "id": "755154", + "name": "Noonie Bao", + "role": "music", + "image": "https://c.saavncdn.com/954/Sorry-Not-Sorry-English-2016-150x150.jpg", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/noonie-bao-/TlZufM7L6sQ_" + }, + { + "id": "1335467", + "name": "Alan Walker", + "role": "singer", + "image": "https://c.saavncdn.com/artists/Alan_Walker_002_20190507112228_150x150.jpg", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/alan-walker-/wbWcxgUNzyo_" + }, + { + "id": "1335467", + "name": "Alan Walker", + "role": "lyricist", + "image": "https://c.saavncdn.com/artists/Alan_Walker_002_20190507112228_150x150.jpg", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/alan-walker-/wbWcxgUNzyo_" + }, + { + "id": "822579", + "name": "Jesper Borgen", + "role": "lyricist", + "image": "", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/jesper-borgen-/2odnY,ZN-jQ_" + }, + { + "id": "1425075", + "name": "Anders Frøen", + "role": "lyricist", + "image": "", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/anders-froen-/Wj4QA5E85tc_" + }, + { + "id": "1625408", + "name": "Gunnar Greve", + "role": "lyricist", + "image": "", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/gunnar-greve-/MYLcGokRN0w_" + }, + { + "id": "648765", + "name": "Jonnali Parmenius", + "role": "lyricist", + "image": "", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/jonnali-parmenius-/C,kojV56,2A_" + } + ], + "description": "Track from Alan Walker from album Alone.", + "hasLyrics": "false", + "language": "English", + "songUrl": "https://www.jiosaavn.com/song/alone-restrung/RBIpQh10Tms", + "albumUrl": "https://www.jiosaavn.com/album/alone/RGziQ8ScK3g_" + }, + { + "id": "8BsyRlFY", + "songName": "Alone, Pt. II", + "albumId": "18273908", + "albumName": "Alone, Pt. II", + "playCount": "8189590", + "imagesUrls": { + "50x50": "http://c.saavncdn.com/574/Alone-Pt-II-English-2019-20191210153050-50x50.jpg", + "150x150": "http://c.saavncdn.com/574/Alone-Pt-II-English-2019-20191210153050-150x150.jpg", + "500x500": "http://c.saavncdn.com/574/Alone-Pt-II-English-2019-20191210153050-500x500.jpg" + }, + "primaryArtists": [ + { + "id": "1335467", + "name": "Alan Walker", + "role": "primary_artists", + "image": "https://c.saavncdn.com/artists/Alan_Walker_002_20190507112228_150x150.jpg", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/alan-walker-/wbWcxgUNzyo_" + }, + { + "id": "3685366", + "name": "Ava Max", + "role": "primary_artists", + "image": "https://c.saavncdn.com/artists/Ava_Max_20190322070605_150x150.jpg", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/ava-max-/ExpLP,ur0tw_" + } + ], + "featuredArtists": [], + "artists": [ + { + "id": "1335467", + "name": "Alan Walker", + "role": "music", + "image": "https://c.saavncdn.com/artists/Alan_Walker_002_20190507112228_150x150.jpg", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/alan-walker-/wbWcxgUNzyo_" + }, + { + "id": "3333917", + "name": "Marcus Arnbekk", + "role": "music", + "image": "https://c.saavncdn.com/063/Sawarne-Lage-Tropical-House-Mix-From-Mitron--Hindi-2018-20180912142000-150x150.jpg", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/marcus-arnbekk-/aAij0Two6rU_" + }, + { + "id": "5936693", + "name": "Alexander Standal Pavelich", + "role": "music", + "image": "", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/alexander-standal-pavelich-/qilY-eLQNJY_" + }, + { + "id": "6003540", + "name": "Amanda Ava Koci", + "role": "music", + "image": "", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/amanda-ava-koci-/6Hu,xwA,2Xs_" + }, + { + "id": "820452", + "name": "Halvor Folstad", + "role": "music", + "image": "", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/halvor-folstad-/yjQsAthxb6U_" + }, + { + "id": "820451", + "name": "Dag Holtan-Hartwig", + "role": "music", + "image": "", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/dag-holtan-hartwig-/RsQKyyo4z5w_" + }, + { + "id": "772800", + "name": "Erik \r\nSmaaland", + "role": "music", + "image": "", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/erik-smaaland-/,kczMl-H-RA_" + }, + { + "id": "6092767", + "name": "Moa Pettersson Hammar", + "role": "music", + "image": "", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/moa-pettersson-hammar-/TO9tzxEz1hM_" + }, + { + "id": "659013", + "name": "Carl Hovind", + "role": "music", + "image": "", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/carl-hovind-/h1VoDMs3MuI_" + }, + { + "id": "1584282", + "name": "Fredrik Borch Olsen", + "role": "music", + "image": "", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/fredrik-borch-olsen-/iq2hSfiwJTE_" + }, + { + "id": "1584281", + "name": "Øyvind Sauvik", + "role": "music", + "image": "", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/Oyvind-sauvik-/,PQoc6ZC7ys_" + }, + { + "id": "1625408", + "name": "Gunnar Greve", + "role": "music", + "image": "", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/gunnar-greve-/MYLcGokRN0w_" + }, + { + "id": "1335467", + "name": "Alan Walker", + "role": "singer", + "image": "https://c.saavncdn.com/artists/Alan_Walker_002_20190507112228_150x150.jpg", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/alan-walker-/wbWcxgUNzyo_" + }, + { + "id": "3685366", + "name": "Ava Max", + "role": "singer", + "image": "https://c.saavncdn.com/artists/Ava_Max_20190322070605_150x150.jpg", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/ava-max-/ExpLP,ur0tw_" + }, + { + "id": "7374795", + "name": "Alan Walker & Ava Max", + "role": "singer", + "image": "", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/alan-walker--ava-max-/pbR4d6hacyk_" + }, + { + "id": "5936693", + "name": "Alexander Standal Pavelich", + "role": "lyricist", + "image": "", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/alexander-standal-pavelich-/qilY-eLQNJY_" + }, + { + "id": "6003540", + "name": "Amanda \r\nAva Koci", + "role": "lyricist", + "image": "", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/amanda-ava-koci-/6Hu,xwA,2Xs_" + }, + { + "id": "820452", + "name": "Halvor Folstad", + "role": "lyricist", + "image": "", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/halvor-folstad-/yjQsAthxb6U_" + }, + { + "id": "820451", + "name": "Dag Holtan-Hartwig", + "role": "lyricist", + "image": "", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/dag-holtan-hartwig-/RsQKyyo4z5w_" + }, + { + "id": "772800", + "name": "Erik Smaaland", + "role": "lyricist", + "image": "", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/erik-smaaland-/,kczMl-H-RA_" + }, + { + "id": "6092767", + "name": "Moa Pettersson Hammar", + "role": "lyricist", + "image": "", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/moa-pettersson-hammar-/TO9tzxEz1hM_" + }, + { + "id": "1584281", + "name": "Øyvind Sauvik", + "role": "lyricist", + "image": "", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/Oyvind-sauvik-/,PQoc6ZC7ys_" + } + ], + "description": "Track from Alan Walker and Ava Max from album Alone, Pt. II.", + "hasLyrics": "false", + "language": "English", + "songUrl": "https://www.jiosaavn.com/song/alone-pt.-ii/SCoYSCZccWo", + "albumUrl": "https://www.jiosaavn.com/album/alone-pt.-ii/ZCqviQsE5dI_" + }, + { + "id": "rE_g9GJw", + "songName": "Alone", + "albumId": "14508997", + "albumName": "Different World", + "playCount": "49127064", + "imagesUrls": { + "50x50": "http://c.saavncdn.com/562/Different-World-English-2018-20181130144209-50x50.jpg", + "150x150": "http://c.saavncdn.com/562/Different-World-English-2018-20181130144209-150x150.jpg", + "500x500": "http://c.saavncdn.com/562/Different-World-English-2018-20181130144209-500x500.jpg" + }, + "primaryArtists": [ + { + "id": "1335467", + "name": "Alan Walker", + "role": "primary_artists", + "image": "http://c.saavncdn.com/artists/Alan_Walker_002_20190507112228_150x150.jpg", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/alan-walker/wbWcxgUNzyo_" + } + ], + "featuredArtists": [], + "artists": [ + { + "id": "1335467", + "name": "Alan Walker", + "role": "music", + "image": "http://c.saavncdn.com/artists/Alan_Walker_002_20190507112228_150x150.jpg", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/alan-walker/wbWcxgUNzyo_" + }, + { + "id": "822579", + "name": "Jesper Borgen", + "role": "music", + "image": "", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/jesper-borgen/2odnY,ZN-jQ_" + }, + { + "id": "1425075", + "name": "Anders Frøen", + "role": "music", + "image": "", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/anders-froen/Wj4QA5E85tc_" + }, + { + "id": "1625408", + "name": "Gunnar Greve", + "role": "music", + "image": "", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/gunnar-greve/MYLcGokRN0w_" + }, + { + "id": "648765", + "name": "Jonnali Parmenius", + "role": "music", + "image": "", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/jonnali-parmenius/C,kojV56,2A_" + }, + { + "id": "1335467", + "name": "Alan Walker", + "role": "singer", + "image": "http://c.saavncdn.com/artists/Alan_Walker_002_20190507112228_150x150.jpg", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/alan-walker/wbWcxgUNzyo_" + }, + { + "id": "1335467", + "name": "Alan Walker", + "role": "lyricist", + "image": "http://c.saavncdn.com/artists/Alan_Walker_002_20190507112228_150x150.jpg", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/alan-walker/wbWcxgUNzyo_" + }, + { + "id": "822579", + "name": "Jesper Borgen", + "role": "lyricist", + "image": "", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/jesper-borgen/2odnY,ZN-jQ_" + }, + { + "id": "1425075", + "name": "Anders Frøen", + "role": "lyricist", + "image": "", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/anders-froen/Wj4QA5E85tc_" + }, + { + "id": "1625408", + "name": "Gunnar Greve", + "role": "lyricist", + "image": "", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/gunnar-greve/MYLcGokRN0w_" + }, + { + "id": "648765", + "name": "Jonnali Parmenius", + "role": "lyricist", + "image": "", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/jonnali-parmenius/C,kojV56,2A_" + } + ], + "description": "Track from Alan Walker from album Different World.", + "hasLyrics": "false", + "language": "English", + "songUrl": "https://www.jiosaavn.com/song/alone/Ai00Vk13fUQ", + "albumUrl": "https://www.jiosaavn.com/album/different-world/rIQHDwKT5do_" + }, + { + "id": "PZZwQkMz", + "songName": "Alone", + "albumId": "11624914", + "albumName": "Alone", + "playCount": "254125", + "imagesUrls": { + "50x50": "http://c.saavncdn.com/229/Alone-English-2017-20171011004751-50x50.jpg", + "150x150": "http://c.saavncdn.com/229/Alone-English-2017-20171011004751-150x150.jpg", + "500x500": "http://c.saavncdn.com/229/Alone-English-2017-20171011004751-500x500.jpg" + }, + "primaryArtists": [ + { + "id": "733470", + "name": "The PropheC", + "role": "primary_artists", + "image": "http://c.saavncdn.com/artists/The_Prophec_001_20180105065027_150x150.jpg", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/the-prophec/fgZhf3jAs,w_" + }, + { + "id": "4328877", + "name": "Arjun", + "role": "primary_artists", + "image": "http://c.saavncdn.com/309/Tingo-English-2019-20190907032346-150x150.jpg", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/arjun/QPoHRfOnxYw_" + } + ], + "featuredArtists": [], + "artists": [ + { + "id": "733470", + "name": "The PropheC", + "role": "singer", + "image": "http://c.saavncdn.com/artists/The_Prophec_001_20180105065027_150x150.jpg", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/the-prophec/fgZhf3jAs,w_" + }, + { + "id": "4328877", + "name": "Arjun", + "role": "singer", + "image": "http://c.saavncdn.com/309/Tingo-English-2019-20190907032346-150x150.jpg", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/arjun/QPoHRfOnxYw_" + } + ], + "description": "Track from The PropheC and Arjun from album Alone.", + "hasLyrics": "false", + "language": "Punjabi", + "songUrl": "https://www.jiosaavn.com/song/alone/IDIxRiVbekk", + "albumUrl": "https://www.jiosaavn.com/album/alone/2WJX1MgJeHE_" + }, + { + "id": "qj84--vy", + "songName": "Alone", + "albumId": "27978399", + "albumName": "Planet Her", + "playCount": "14695", + "imagesUrls": { + "50x50": "http://c.saavncdn.com/852/Planet-Her-English-2021-20210621224521-50x50.jpg", + "150x150": "http://c.saavncdn.com/852/Planet-Her-English-2021-20210621224521-150x150.jpg", + "500x500": "http://c.saavncdn.com/852/Planet-Her-English-2021-20210621224521-500x500.jpg" + }, + "primaryArtists": [ + { + "id": "697799", + "name": "Doja Cat", + "role": "primary_artists", + "image": "http://c.saavncdn.com/artists/Doja_Cat_20200218145042_150x150.jpg", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/doja-cat/GuwOruHLpLk_" + } + ], + "featuredArtists": [], + "artists": [ + { + "id": "697800", + "name": "Amala Zandile Dlamini", + "role": "music", + "image": "", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/amala-zandile-dlamini/2vDxJiTJILg_" + }, + { + "id": "1369835", + "name": "David Sprecher", + "role": "music", + "image": "", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/david-sprecher/I0riLFoGTFM_" + }, + { + "id": "711386", + "name": "Linden Jay", + "role": "music", + "image": "http://c.saavncdn.com/artists/Linden_Jay_20200801080928_150x150.jpg", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/linden-jay/MayJGMfyFFE_" + }, + { + "id": "1612237", + "name": "Geordan Reid-Campbell", + "role": "music", + "image": "", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/geordan-reid-campbell/4DXeN7Rfry0_" + }, + { + "id": "1832834", + "name": "Laura Roy", + "role": "music", + "image": "http://c.saavncdn.com/509/Temporary-English-2018-20180628142700-150x150.jpg", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/laura-roy/esJI34CKlL4_" + }, + { + "id": "572447", + "name": "Antwoine Collins", + "role": "music", + "image": "", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/antwoine-collins/E3ZI75XCjN0_" + }, + { + "id": "697799", + "name": "Doja Cat", + "role": "singer", + "image": "http://c.saavncdn.com/artists/Doja_Cat_20200218145042_150x150.jpg", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/doja-cat/GuwOruHLpLk_" + }, + { + "id": "697800", + "name": "Amala Zandile Dlamini", + "role": "lyricist", + "image": "", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/amala-zandile-dlamini/2vDxJiTJILg_" + }, + { + "id": "1369835", + "name": "David Sprecher", + "role": "lyricist", + "image": "", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/david-sprecher/I0riLFoGTFM_" + }, + { + "id": "711386", + "name": "Linden Jay", + "role": "lyricist", + "image": "http://c.saavncdn.com/artists/Linden_Jay_20200801080928_150x150.jpg", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/linden-jay/MayJGMfyFFE_" + }, + { + "id": "1612237", + "name": "Geordan Reid-Campbell", + "role": "lyricist", + "image": "", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/geordan-reid-campbell/4DXeN7Rfry0_" + }, + { + "id": "1832834", + "name": "Laura Roy", + "role": "lyricist", + "image": "http://c.saavncdn.com/509/Temporary-English-2018-20180628142700-150x150.jpg", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/laura-roy/esJI34CKlL4_" + }, + { + "id": "572447", + "name": "Antwoine Collins", + "role": "lyricist", + "image": "", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/antwoine-collins/E3ZI75XCjN0_" + } + ], + "description": "Track from Doja Cat from album Planet Her.", + "hasLyrics": "false", + "language": "English", + "songUrl": "https://www.jiosaavn.com/song/alone/AQJTBVkdQUo", + "albumUrl": "https://www.jiosaavn.com/album/planet-her/0dhlIg,ymL4_" + }, + { + "id": "HGdNS35N", + "songName": "Alone (Lost Frequencies Remix)", + "albumId": "10294431", + "albumName": "Alone (Remixes)", + "playCount": "120132", + "imagesUrls": { + "50x50": "http://c.saavncdn.com/173/Alone-Remixes--English-2017-50x50.jpg", + "150x150": "http://c.saavncdn.com/173/Alone-Remixes--English-2017-150x150.jpg", + "500x500": "http://c.saavncdn.com/173/Alone-Remixes--English-2017-500x500.jpg" + }, + "primaryArtists": [ + { + "id": "1335467", + "name": "Alan Walker", + "role": "primary_artists", + "image": "http://c.saavncdn.com/artists/Alan_Walker_002_20190507112228_150x150.jpg", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/alan-walker/wbWcxgUNzyo_" + } + ], + "featuredArtists": [], + "artists": [ + { + "id": "1335467", + "name": "Alan Walker", + "role": "music", + "image": "http://c.saavncdn.com/artists/Alan_Walker_002_20190507112228_150x150.jpg", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/alan-walker/wbWcxgUNzyo_" + }, + { + "id": "822579", + "name": "Jesper Borgen", + "role": "music", + "image": "", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/jesper-borgen/2odnY,ZN-jQ_" + }, + { + "id": "1425075", + "name": "Anders Frøen", + "role": "music", + "image": "", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/anders-froen/Wj4QA5E85tc_" + }, + { + "id": "1625408", + "name": "Gunnar Greve", + "role": "music", + "image": "", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/gunnar-greve/MYLcGokRN0w_" + }, + { + "id": "755154", + "name": "Noonie Bao", + "role": "music", + "image": "http://c.saavncdn.com/954/Sorry-Not-Sorry-English-2016-150x150.jpg", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/noonie-bao/TlZufM7L6sQ_" + }, + { + "id": "1335467", + "name": "Alan Walker", + "role": "singer", + "image": "http://c.saavncdn.com/artists/Alan_Walker_002_20190507112228_150x150.jpg", + "type": "artist", + "perma_url": "https://www.jiosaavn.com/artist/alan-walker/wbWcxgUNzyo_" + } + ], + "description": "Track from Alan Walker from album Alone (Remixes).", + "hasLyrics": "false", + "language": "English", + "songUrl": "https://www.jiosaavn.com/song/alone-lost-frequencies-remix/OC8PfycDAn0", + "albumUrl": "https://www.jiosaavn.com/album/alone-remixes/v6elO30IMmw_" + } ] ```
@@ -74,7 +1123,13 @@ print(search) #### Search for only albums ```python -from JioSaavn import searchAlbum +# Async +from jiosaavn.Async import searchAlbum +search = await searchAlbum('alone') +print(search) + +# Sync +from jiosaavn.Sync import searchAlbum search = await searchAlbum('alone') print(search) ``` @@ -84,39 +1139,52 @@ print(search) ```json [ - { - "id": "29782034", - "title": "Alone Alone (From "Malli Modalaindi")", - "image": "https://c.saavncdn.com/156/Alone-Alone-From-Malli-Modalaindi--Telugu-2021-20210920131019-150x150.jpg", - "images": { - "50x50": "https://c.saavncdn.com/156/Alone-Alone-From-Malli-Modalaindi--Telugu-2021-20210920131019-50x50.jpg", - "150x150": "https://c.saavncdn.com/156/Alone-Alone-From-Malli-Modalaindi--Telugu-2021-20210920131019-150x150.jpg", - "500x500": "https://c.saavncdn.com/156/Alone-Alone-From-Malli-Modalaindi--Telugu-2021-20210920131019-500x500.jpg" - }, - "music": "Sid Sriram, Anup Rubens", - "description": "2021 · Telugu Album · Sid Sriram, Anup Rubens", - "year": "2021", - "language": "Telugu", - "url": "https://www.jiosaavn.com/album/alone-alone-from-malli-modalaindi/lLQ4oVnaTvM_", - "song": "HgyjuLNF", - }, - { - "id": "1215558", - "title": "Alone", - "image": "https://c.saavncdn.com/794/Alone-Hindi-2014-150x150.jpg", - "images": { - "50x50": "https://c.saavncdn.com/794/Alone-Hindi-2014-50x50.jpg", - "150x150": "https://c.saavncdn.com/794/Alone-Hindi-2014-150x150.jpg", - "500x500": "https://c.saavncdn.com/794/Alone-Hindi-2014-500x500.jpg" - }, - "music": "Ankit Tiwari", - "description": "2014 · Hindi Film · Ankit Tiwari", - "year": "2014", - "language": "Hindi", - "url": "https://www.jiosaavn.com/album/alone/MmI5C7Qd8xU_", - "song": "woZT1XKb, BW3ZjaVE, 30LGCvEo, IVnaw30E", - }, -] + { + "id": "10149322", + "albumName": "Alone", + "music": "Alan Walker", + "description": "2016 · English Album · Alan Walker", + "year": "2016", + "language": "English", + "songIds": "mlOelmXY, JV7dA4mV, 4zBsiDyX", + "albumUrl": "https://www.jiosaavn.com/album/alone/RGziQ8ScK3g_", + "imagesUrls": { + "50x50": "http://c.saavncdn.com/522/Alone-English-2017-20180131085202-50x50.jpg", + "150x150": "http://c.saavncdn.com/522/Alone-English-2017-20180131085202-150x150.jpg", + "500x500": "http://c.saavncdn.com/522/Alone-English-2017-20180131085202-500x500.jpg" + } + }, + { + "id": "29782034", + "albumName": "Alone Alone (From "Malli Modalaindi")", + "music": "Sid Sriram, Anup Rubens", + "description": "2021 · Telugu Album · Sid Sriram, Anup Rubens", + "year": "2021", + "language": "Telugu", + "songIds": "HgyjuLNF", + "albumUrl": "https://www.jiosaavn.com/album/alone-alone-from-malli-modalaindi/lLQ4oVnaTvM_", + "imagesUrls": { + "50x50": "http://c.saavncdn.com/156/Alone-Alone-From-Malli-Modalaindi--Telugu-2021-20210920131019-50x50.jpg", + "150x150": "http://c.saavncdn.com/156/Alone-Alone-From-Malli-Modalaindi--Telugu-2021-20210920131019-150x150.jpg", + "500x500": "http://c.saavncdn.com/156/Alone-Alone-From-Malli-Modalaindi--Telugu-2021-20210920131019-500x500.jpg" + } + }, + { + "id": "1215558", + "albumName": "Alone", + "music": "Ankit Tiwari", + "description": "2014 · Hindi Film · Ankit Tiwari", + "year": "2014", + "language": "Hindi", + "songIds": "woZT1XKb, BW3ZjaVE, 30LGCvEo, IVnaw30E", + "albumUrl": "https://www.jiosaavn.com/album/alone/MmI5C7Qd8xU_", + "imagesUrls": { + "50x50": "http://c.saavncdn.com/794/Alone-Hindi-2014-50x50.jpg", + "150x150": "http://c.saavncdn.com/794/Alone-Hindi-2014-150x150.jpg", + "500x500": "http://c.saavncdn.com/794/Alone-Hindi-2014-500x500.jpg" + } + } +] ``` @@ -124,11 +1192,17 @@ print(search) #### Get Album from url or id ```python -from JioSaavn import album -result = await album(id='10496527') -OR +# Async +from jiosaavn.Async import album +# result = await album(id='10496527') result = await album(url='https://www.jiosaavn.com/album/baahubali-2---the-conclusion/Vm5jaOSkM7E_') print(result) + +# Sync +from jiosaavn.Sync import album +# result = album(id='10496527') +result = album(url='https://www.jiosaavn.com/album/baahubali-2---the-conclusion/Vm5jaOSkM7E_') +print(result) ```
@@ -136,134 +1210,183 @@ print(result) ```json { - "albumid": "10496527", - "title": "Baahubali 2 - The Conclusion", - "name": "Baahubali 2 - The Conclusion", - "year": "2017", - "primary_artists": [ - "M. M. Keeravani" - ], - "image": "https://c.saavncdn.com/271/Baahubali-2-The-Conclusion-Telugu-2017-150x150.jpg", - "songs": [ - { - "id": "blMuXL1P", - "song": "Saahore Baahubali", - "album": "Baahubali 2 - The Conclusion", - "year": "2017", - "primary_artists": [ - "Daler Mehndi", - "M. M. Keeravani", - "Mounima Ch" - ], - "singers": [ - "Daler Mehndi", - "M. M. Keeravani", - "Mounima Ch" - ], - "image": "https://c.saavncdn.com/271/Baahubali-2-The-Conclusion-Telugu-2017-500x500.jpg", - "images": { - "50x50": "https://c.saavncdn.com/271/Baahubali-2-The-Conclusion-Telugu-2017-50x50.jpg", - "150x150": "https://c.saavncdn.com/271/Baahubali-2-The-Conclusion-Telugu-2017-150x150.jpg", - "500x500": "https://c.saavncdn.com/271/Baahubali-2-The-Conclusion-Telugu-2017-500x500.jpg" - }, - "duration": "203", - "label": "Lahari Music", - "albumid": "10496527", - "language": "Telugu", - "copyright_text": "© 2017 Lahari Music", - "has_lyrics": "true", - "lyrics": null, - "media_url": "https://aac.saavncdn.com/271/22dda6f74d38544c0b0d27d65ddddac1_160.mp4", - "media_urls": { - "96_KBPS": "https://aac.saavncdn.com/271/22dda6f74d38544c0b0d27d65ddddac1_96.mp4", - "160_KBPS": "https://aac.saavncdn.com/271/22dda6f74d38544c0b0d27d65ddddac1_160.mp4", - "320_KBPS": "https://aac.saavncdn.com/271/22dda6f74d38544c0b0d27d65ddddac1_320.mp4" - }, - "release_date": "2017-03-26", - "url": { - "song": "https://www.jiosaavn.com/song/saahore-baahubali/EgQmRCx8BmM", - "album": "https://www.jiosaavn.com/album/baahubali-2---the-conclusion/Vm5jaOSkM7E_" - }, - }, - { - "id": "XvwEmXL_", - "song": "Hamsa Naava", - "album": "Baahubali 2 - The Conclusion", - "year": "2017", - "primary_artists": [ - "Sony", - "Deepu" - ], - "singers": [ - "Sony", - "Deepu" - ], - "image": "https://c.saavncdn.com/271/Baahubali-2-The-Conclusion-Telugu-2017-500x500.jpg", - "images": { - "50x50": "https://c.saavncdn.com/271/Baahubali-2-The-Conclusion-Telugu-2017-50x50.jpg", - "150x150": "https://c.saavncdn.com/271/Baahubali-2-The-Conclusion-Telugu-2017-150x150.jpg", - "500x500": "https://c.saavncdn.com/271/Baahubali-2-The-Conclusion-Telugu-2017-500x500.jpg" - }, - "duration": "204", - "label": "Lahari Music", - "albumid": "10496527", - "language": "Telugu", - "copyright_text": "© 2017 Lahari Music", - "has_lyrics": "true", - "lyrics": null, - "media_url": "https://aac.saavncdn.com/271/5d651eeaa54b93af16a7c39999615f2d_160.mp4", - "media_urls": { - "96_KBPS": "https://aac.saavncdn.com/271/5d651eeaa54b93af16a7c39999615f2d_96.mp4", - "160_KBPS": "https://aac.saavncdn.com/271/5d651eeaa54b93af16a7c39999615f2d_160.mp4", - "320_KBPS": "https://aac.saavncdn.com/271/5d651eeaa54b93af16a7c39999615f2d_320.mp4" - }, - "release_date": "2017-03-26", - "url": { - "song": "https://www.jiosaavn.com/song/hamsa-naava/KB4cdBloe2w", - "album": "https://www.jiosaavn.com/album/baahubali-2---the-conclusion/Vm5jaOSkM7E_" - }, - }, - { - "id": "M3D7qn6T", - "song": "Kannaa Nidurinchara", - "album": "Baahubali 2 - The Conclusion", - "year": "2017", - "primary_artists": [ - "Sreenidhi Tirumala", - "V. Srisoumya" - ], - "singers": [ - "Sreenidhi Tirumala", - "V. Srisoumya" - ], - "image": "https://c.saavncdn.com/271/Baahubali-2-The-Conclusion-Telugu-2017-500x500.jpg", - "images": { - "50x50": "https://c.saavncdn.com/271/Baahubali-2-The-Conclusion-Telugu-2017-50x50.jpg", - "150x150": "https://c.saavncdn.com/271/Baahubali-2-The-Conclusion-Telugu-2017-150x150.jpg", - "500x500": "https://c.saavncdn.com/271/Baahubali-2-The-Conclusion-Telugu-2017-500x500.jpg" - }, - "duration": "291", - "label": "Lahari Music", - "albumid": "10496527", - "language": "Telugu", - "copyright_text": "© 2017 Lahari Music", - "has_lyrics": "true", - "lyrics": null, - "media_url": "https://aac.saavncdn.com/271/5e4fe5350641ff6c285d79676a483222_160.mp4", - "media_urls": { - "96_KBPS": "https://aac.saavncdn.com/271/5e4fe5350641ff6c285d79676a483222_96.mp4", - "160_KBPS": "https://aac.saavncdn.com/271/5e4fe5350641ff6c285d79676a483222_160.mp4", - "320_KBPS": "https://aac.saavncdn.com/271/5e4fe5350641ff6c285d79676a483222_320.mp4" - }, - "release_date": "2017-03-26", - "url": { - "song": "https://www.jiosaavn.com/song/kannaa-nidurinchara/PVsvBgVeAWc", - "album": "https://www.jiosaavn.com/album/baahubali-2---the-conclusion/Vm5jaOSkM7E_" - }, - }, - ], - "perma_url": "https://www.jiosaavn.com/album/baahubali-2---the-conclusion/Vm5jaOSkM7E_", - "release_date": "2017-03-26" + "albumId": "10496527", + "title": "Baahubali 2 - The Conclusion", + "name": "Baahubali 2 - The Conclusion", + "year": "2017", + "primaryArtists": [ + "M. M. Keeravani" + ], + "image": "https://c.saavncdn.com/271/Baahubali-2-The-Conclusion-Telugu-2017-150x150.jpg", + "songs": [ + { + "id": "blMuXL1P", + "songName": "Saahore Baahubali", + "albumName": "Baahubali 2 - The Conclusion", + "albumId": "10496527", + "playCount": "8446610", + "duration": "203", + "label": "Lahari Music", + "primaryArtists": "Daler Mehndi, M. M. Keeravani, Mounima Ch", + "primaryArtistsId": "455652, 813721, 2632973", + "featuredArtists": "", + "featuredArtistsId": "", + "singers": "Daler Mehndi, M. M. Keeravani, Mounima Ch", + "starring": "Prabhas, Anushka Shetty, Tamannaah Bhatia, Rana Daggubati, Sathyaraj, Nassar, Ramya Krishna, Subbaraju", + "language": "Telugu", + "copyright": "© 2017 Lahari Music", + "hasLyrics": "true", + "lyrics": null, + "releaseDate": "2017-03-26", + "songUrl": "https://www.jiosaavn.com/song/saahore-baahubali/EgQmRCx8BmM", + "albumUrl": "https://www.jiosaavn.com/album/baahubali-2---the-conclusion/Vm5jaOSkM7E_", + "imagesUrls": { + "50x50": "https://c.saavncdn.com/271/Baahubali-2-The-Conclusion-Telugu-2017-50x50.jpg", + "150x150": "https://c.saavncdn.com/271/Baahubali-2-The-Conclusion-Telugu-2017-150x150.jpg", + "500x500": "https://c.saavncdn.com/271/Baahubali-2-The-Conclusion-Telugu-2017-500x500.jpg" + }, + "audioUrls": { + "96_KBPS": "https://aac.saavncdn.com/271/22dda6f74d38544c0b0d27d65ddddac1_96.mp4", + "160_KBPS": "https://aac.saavncdn.com/271/22dda6f74d38544c0b0d27d65ddddac1_160.mp4", + "320_KBPS": "https://aac.saavncdn.com/271/22dda6f74d38544c0b0d27d65ddddac1_320.mp4" + }, + "labelUrl": "https://www.jiosaavn.com/label/lahari-music-albums/L899GJu3hlQ_" + }, + { + "id": "XvwEmXL_", + "songName": "Hamsa Naava", + "albumName": "Baahubali 2 - The Conclusion", + "albumId": "10496527", + "playCount": "8985568", + "duration": "204", + "label": "Lahari Music", + "primaryArtists": "Sony, Deepu", + "primaryArtistsId": "593945, 455239", + "featuredArtists": "", + "featuredArtistsId": "", + "singers": "Sony, Deepu", + "starring": "Prabhas, Anushka Shetty, Tamannaah Bhatia, Rana Daggubati, Sathyaraj, Nassar, Ramya Krishna, Subbaraju", + "language": "Telugu", + "copyright": "© 2017 Lahari Music", + "hasLyrics": "true", + "lyrics": null, + "releaseDate": "2017-03-26", + "songUrl": "https://www.jiosaavn.com/song/hamsa-naava/KB4cdBloe2w", + "albumUrl": "https://www.jiosaavn.com/album/baahubali-2---the-conclusion/Vm5jaOSkM7E_", + "imagesUrls": { + "50x50": "https://c.saavncdn.com/271/Baahubali-2-The-Conclusion-Telugu-2017-50x50.jpg", + "150x150": "https://c.saavncdn.com/271/Baahubali-2-The-Conclusion-Telugu-2017-150x150.jpg", + "500x500": "https://c.saavncdn.com/271/Baahubali-2-The-Conclusion-Telugu-2017-500x500.jpg" + }, + "audioUrls": { + "96_KBPS": "https://aac.saavncdn.com/271/5d651eeaa54b93af16a7c39999615f2d_96.mp4", + "160_KBPS": "https://aac.saavncdn.com/271/5d651eeaa54b93af16a7c39999615f2d_160.mp4", + "320_KBPS": "https://aac.saavncdn.com/271/5d651eeaa54b93af16a7c39999615f2d_320.mp4" + }, + "labelUrl": "https://www.jiosaavn.com/label/lahari-music-albums/L899GJu3hlQ_" + }, + { + "id": "M3D7qn6T", + "songName": "Kannaa Nidurinchara", + "albumName": "Baahubali 2 - The Conclusion", + "albumId": "10496527", + "playCount": "4455028", + "duration": "291", + "label": "Lahari Music", + "primaryArtists": "Sreenidhi Tirumala, V. Srisoumya", + "primaryArtistsId": "5523265, 3112246", + "featuredArtists": "", + "featuredArtistsId": "", + "singers": "Sreenidhi Tirumala, V. Srisoumya", + "starring": "Prabhas, Anushka Shetty, Tamannaah Bhatia, Rana Daggubati, Sathyaraj, Nassar, Ramya Krishna, Subbaraju", + "language": "Telugu", + "copyright": "© 2017 Lahari Music", + "hasLyrics": "true", + "lyrics": null, + "releaseDate": "2017-03-26", + "songUrl": "https://www.jiosaavn.com/song/kannaa-nidurinchara/PVsvBgVeAWc", + "albumUrl": "https://www.jiosaavn.com/album/baahubali-2---the-conclusion/Vm5jaOSkM7E_", + "imagesUrls": { + "50x50": "https://c.saavncdn.com/271/Baahubali-2-The-Conclusion-Telugu-2017-50x50.jpg", + "150x150": "https://c.saavncdn.com/271/Baahubali-2-The-Conclusion-Telugu-2017-150x150.jpg", + "500x500": "https://c.saavncdn.com/271/Baahubali-2-The-Conclusion-Telugu-2017-500x500.jpg" + }, + "audioUrls": { + "96_KBPS": "https://aac.saavncdn.com/271/5e4fe5350641ff6c285d79676a483222_96.mp4", + "160_KBPS": "https://aac.saavncdn.com/271/5e4fe5350641ff6c285d79676a483222_160.mp4", + "320_KBPS": "https://aac.saavncdn.com/271/5e4fe5350641ff6c285d79676a483222_320.mp4" + }, + "labelUrl": "https://www.jiosaavn.com/label/lahari-music-albums/L899GJu3hlQ_" + }, + { + "id": "VclbtPav", + "songName": "Dandaalayyaa", + "albumName": "Baahubali 2 - The Conclusion", + "albumId": "10496527", + "playCount": "7810471", + "duration": "210", + "label": "Lahari Music", + "primaryArtists": "Kaala Bhairava", + "primaryArtistsId": "1941508", + "featuredArtists": "", + "featuredArtistsId": "", + "singers": "Kaala Bhairava", + "starring": "Prabhas, Anushka Shetty, Tamannaah Bhatia, Rana Daggubati, Sathyaraj, Nassar, Ramya Krishna, Subbaraju", + "language": "Telugu", + "copyright": "© 2017 Lahari Music", + "hasLyrics": "true", + "lyrics": null, + "releaseDate": "2017-03-26", + "songUrl": "https://www.jiosaavn.com/song/dandaalayyaa/JgsHUwBgVkU", + "albumUrl": "https://www.jiosaavn.com/album/baahubali-2---the-conclusion/Vm5jaOSkM7E_", + "imagesUrls": { + "50x50": "https://c.saavncdn.com/271/Baahubali-2-The-Conclusion-Telugu-2017-50x50.jpg", + "150x150": "https://c.saavncdn.com/271/Baahubali-2-The-Conclusion-Telugu-2017-150x150.jpg", + "500x500": "https://c.saavncdn.com/271/Baahubali-2-The-Conclusion-Telugu-2017-500x500.jpg" + }, + "audioUrls": { + "96_KBPS": "https://aac.saavncdn.com/271/2faba1a6f1efc5eacffb400b903018fa_96.mp4", + "160_KBPS": "https://aac.saavncdn.com/271/2faba1a6f1efc5eacffb400b903018fa_160.mp4", + "320_KBPS": "https://aac.saavncdn.com/271/2faba1a6f1efc5eacffb400b903018fa_320.mp4" + }, + "labelUrl": "https://www.jiosaavn.com/label/lahari-music-albums/L899GJu3hlQ_" + }, + { + "id": "TqF9_GIG", + "songName": "Oka Praanam", + "albumName": "Baahubali 2 - The Conclusion", + "albumId": "10496527", + "playCount": "4905658", + "duration": "173", + "label": "Lahari Music", + "primaryArtists": "Kaala Bhairava", + "primaryArtistsId": "1941508", + "featuredArtists": "", + "featuredArtistsId": "", + "singers": "Kaala Bhairava", + "starring": "Prabhas, Anushka Shetty, Tamannaah Bhatia, Rana Daggubati, Sathyaraj, Nassar, Ramya Krishna, Subbaraju", + "language": "Telugu", + "copyright": "© 2017 Lahari Music", + "hasLyrics": "true", + "lyrics": null, + "releaseDate": "2017-03-26", + "songUrl": "https://www.jiosaavn.com/song/oka-praanam/JBktCCt3fnQ", + "albumUrl": "https://www.jiosaavn.com/album/baahubali-2---the-conclusion/Vm5jaOSkM7E_", + "imagesUrls": { + "50x50": "https://c.saavncdn.com/271/Baahubali-2-The-Conclusion-Telugu-2017-50x50.jpg", + "150x150": "https://c.saavncdn.com/271/Baahubali-2-The-Conclusion-Telugu-2017-150x150.jpg", + "500x500": "https://c.saavncdn.com/271/Baahubali-2-The-Conclusion-Telugu-2017-500x500.jpg" + }, + "audioUrls": { + "96_KBPS": "https://aac.saavncdn.com/271/02e7896ac6dee9a2b49c45b96d5583cf_96.mp4", + "160_KBPS": "https://aac.saavncdn.com/271/02e7896ac6dee9a2b49c45b96d5583cf_160.mp4", + "320_KBPS": "https://aac.saavncdn.com/271/02e7896ac6dee9a2b49c45b96d5583cf_320.mp4" + }, + "labelUrl": "https://www.jiosaavn.com/label/lahari-music-albums/L899GJu3hlQ_" + } + ], + "songUrl": "https://www.jiosaavn.com/album/baahubali-2---the-conclusion/Vm5jaOSkM7E_", + "releaseDate": "2017-03-26" } ``` @@ -273,11 +1396,17 @@ print(result) #### Get song from url or id ```python -from JioSaavn import song -result = await song(id='veJXEDAz') -OR +# Async +from jiosaavn.Async import song +# result = await song(id='veJXEDAz') result = await song(url='https://www.jiosaavn.com/song/alone/Bg0haTF0dkk') print(result) + +# Sync +from jiosaavn.Sync import song +# result = song(id='veJXEDAz') +result = song(url='https://www.jiosaavn.com/song/alone/Bg0haTF0dkk') +print(result) ```
@@ -285,40 +1414,37 @@ print(result) ```json { - "id": "veJXEDAz", - "song": "Alone", - "album": "Alone", - "year": "2020", - "primary_artists": [ - "Raashi Sood" - ], - "singers": [ - "Raashi Sood" - ], - "image": "https://c.saavncdn.com/743/Alone-Punjabi-2020-20200507184621-500x500.jpg", - "images": { - "50x50": "https://c.saavncdn.com/743/Alone-Punjabi-2020-20200507184621-50x50.jpg", - "150x150": "https://c.saavncdn.com/743/Alone-Punjabi-2020-20200507184621-150x150.jpg", - "500x500": "https://c.saavncdn.com/743/Alone-Punjabi-2020-20200507184621-500x500.jpg" - }, - "duration": "120", - "label": "Raashi Sood Music", - "albumid": "20256407", - "language": "Punjabi", - "copyright_text": "© 2020 Raashi Sood Music", - "has_lyrics": "false", - "lyrics": null, - "media_url": "https://aac.saavncdn.com/743/dc78d52426dff2c0bf8e755c4721c398_160.mp4", - "media_urls": { - "96_KBPS": "https://aac.saavncdn.com/743/dc78d52426dff2c0bf8e755c4721c398_96.mp4", - "160_KBPS": "https://aac.saavncdn.com/743/dc78d52426dff2c0bf8e755c4721c398_160.mp4", - "320_KBPS": "https://aac.saavncdn.com/743/dc78d52426dff2c0bf8e755c4721c398_320.mp4" - }, - "release_date": "2020-05-07", - "url": { - "song": "https://www.jiosaavn.com/song/alone/Bg0haTF0dkk", - "album": "https://www.jiosaavn.com/album/alone/,kQ0LrBIybc_" - }, + "id": "veJXEDAz", + "songName": "Alone", + "albumName": "Alone", + "albumId": "20256407", + "playCount": 102546, + "duration": "120", + "label": "Raashi Sood Music", + "primaryArtists": "Raashi Sood", + "primaryArtistsId": "758310", + "featuredArtists": "", + "featuredArtistsId": "", + "singers": "Raashi Sood", + "starring": "", + "language": "Punjabi", + "copyright": "© 2020 Raashi Sood Music", + "hasLyrics": "false", + "lyrics": null, + "releaseDate": "2020-05-07", + "songUrl": "https://www.jiosaavn.com/song/alone/Bg0haTF0dkk", + "albumUrl": "https://www.jiosaavn.com/album/alone/,kQ0LrBIybc_", + "imagesUrls": { + "50x50": "https://c.saavncdn.com/743/Alone-Punjabi-2020-20200507184621-50x50.jpg", + "150x150": "https://c.saavncdn.com/743/Alone-Punjabi-2020-20200507184621-150x150.jpg", + "500x500": "https://c.saavncdn.com/743/Alone-Punjabi-2020-20200507184621-500x500.jpg" + }, + "audioUrls": { + "96_KBPS": "https://aac.saavncdn.com/743/dc78d52426dff2c0bf8e755c4721c398_96.mp4", + "160_KBPS": "https://aac.saavncdn.com/743/dc78d52426dff2c0bf8e755c4721c398_160.mp4", + "320_KBPS": "https://aac.saavncdn.com/743/dc78d52426dff2c0bf8e755c4721c398_320.mp4" + }, + "labelUrl": "https://www.jiosaavn.com/label/raashi-sood-music-albums/P4Ln5V7QgIA_" } ``` @@ -327,11 +1453,17 @@ print(result) #### Get lyric from url or id ```python -from JioSaavn import lyrics -result = await lyrics(id='blMuXL1P') -OR +# Async +from jiosaavn.Async import lyrics +# result = await lyrics(id='blMuXL1P') result = await lyrics(url='https://www.jiosaavn.com/song/alone/Bg0haTF0dkk') print(result) + +# Sync +from jiosaavn.Sync import lyrics +# result = lyrics(id='blMuXL1P') +result = lyrics(url='https://www.jiosaavn.com/song/alone/Bg0haTF0dkk') +print(result) ```
@@ -339,9 +1471,9 @@ print(result) ```json { - "lyrics": "bhali bhali bhalira bhali
sahore bahubali
bhali bhali bhalira bhali
sahore bahubali
jayaarti nike pattali pattali
bhuvanalanni jai kottali
gaganale chhatra pattali

haiss rudrass haisarbhadra samudrass
haiss rudrass haisarbhadra samudrass
haiss rudrass haisarbhadra samudrass
haiss rudrass haisarbhadra samudrass

aa janani deeksha achalam
i koduke kavachan
ippuda ammaki amm ainanduka
pulkarinchindiga i kshana

aduulu guttal mittal gaminch
pidikit pidugul patti minch
arikul vargal durgal jayinch
avaniki swarganne dinch

ant maha baludina amm ori pasiwade
shivudaina bhavudaina ammaku sat kadantade

haiss rudrass haisarbhadra samudrass
haiss rudrass haisarbhadra samudrass
haiss rudrass haiss rudrass
haisarbhadra samudrass haisarbhadra samudrass
haiss rudrass haisarbhadra samudrass
haiss rudrass haisarbhadra samudrass
haiss rudrass haisarbhadra samudrass
haiss rudrass haisarbhadra samudrass
haiss rudrass haisarbhadra samudrass

bhali bhali bhalira bhali
sahore bahubali
jayaarti nike pattali
bhali bhali bhalira bhali
sahore bahubali
jayaarti nike pattali pattali
bhuvanalanni jai kottali
gaganale chhatra pattali", - "lyrics_copyright": "Writer(s): M. M. Keeravaani, Shiva Shakthi Datta, K. Ramakrishna Lyrics powered by www.musixmatch.com", - "snippet": "haiss rudrass haisarbhadra samudrass" + "lyrics": "bhali bhali bhalira bhali
sahore bahubali
bhali bhali bhalira bhali
sahore bahubali
jayaarti nike pattali pattali
bhuvanalanni jai kottali
gaganale chhatra pattali

haiss rudrass haisarbhadra samudrass
haiss rudrass haisarbhadra samudrass
haiss rudrass haisarbhadra samudrass
haiss rudrass haisarbhadra samudrass

aa janani deeksha achalam
i koduke kavachan
ippuda ammaki amm ainanduka
pulkarinchindiga i kshana

aduulu guttal mittal gaminch
pidikit pidugul patti minch
arikul vargal durgal jayinch
avaniki swarganne dinch

ant maha baludina amm ori pasiwade
shivudaina bhavudaina ammaku sat kadantade

haiss rudrass haisarbhadra samudrass
haiss rudrass haisarbhadra samudrass
haiss rudrass haiss rudrass
haisarbhadra samudrass haisarbhadra samudrass
haiss rudrass haisarbhadra samudrass
haiss rudrass haisarbhadra samudrass
haiss rudrass haisarbhadra samudrass
haiss rudrass haisarbhadra samudrass
haiss rudrass haisarbhadra samudrass

bhali bhali bhalira bhali
sahore bahubali
jayaarti nike pattali
bhali bhali bhalira bhali
sahore bahubali
jayaarti nike pattali pattali
bhuvanalanni jai kottali
gaganale chhatra pattali", + "lyrics_copyright": "Writer(s): M. M. Keeravaani, Shiva Shakthi Datta, K. Ramakrishna\nLyrics powered by www.musixmatch.com", + "snippet": "haiss rudrass haisarbhadra samudrass" } ``` @@ -350,146 +1482,593 @@ print(result) #### Get playlist from url or id ```python -from JioSaavn import playlist -result = await playlist(id='268477478') -OR +# Async +from jiosaavn.Async import playlist +# result = await playlist(id='268477478') result = await playlist(url='https://www.jiosaavn.com/s/playlist/88063878238ad9a391a33c0e628d2b01/90s_Love/OykxHSA0YytFo9wdEAzFBA__') print(result) + +# Sync +from jiosaavn.Sync import playlist +# result = playlist(id='268477478') +result = playlist(url='https://www.jiosaavn.com/s/playlist/88063878238ad9a391a33c0e628d2b01/90s_Love/OykxHSA0YytFo9wdEAzFBA__') +print(result) ```
Example Result ```json - { - "listid": "268477478", - "title": "90's Love", - "username": "", - "list_count": "17", - "uid": "88063878238ad9a391a33c0e628d2b01", - "perma_url": "https://www.jiosaavn.com/s/playlist/88063878238ad9a391a33c0e628d2b01/90s_Love/OykxHSA0YytFo9wdEAzFBA__", - "image": "https://pli.saavncdn.com/74/78/268477478.jpg?bch=1555760417", - "songs": [ - { - "id": "2XLkr2Gd", - "song": "Kal Ho Naa Ho", - "album": "Kal Ho Naa Ho (Original Motion Picture Soundtrack)", - "year": "2003", - "primary_artists": [ - "Shankar-Ehsaan-Loy", - "Sonu Nigam" - ], - "singers": [ - "Shankar-Ehsaan-Loy", - "Sonu Nigam" - ], - "image": "https://c.saavncdn.com/909/Kal-Ho-Naa-Ho-Hindi-2003-500x500.jpg", - "images": { - "50x50": "https://c.saavncdn.com/909/Kal-Ho-Naa-Ho-Hindi-2003-50x50.jpg", - "150x150": "https://c.saavncdn.com/909/Kal-Ho-Naa-Ho-Hindi-2003-150x150.jpg", - "500x500": "https://c.saavncdn.com/909/Kal-Ho-Naa-Ho-Hindi-2003-500x500.jpg" - }, - "duration": "321", - "label": "Sony Music Entertainment India Pvt. Ltd.", - "albumid": "1208084", - "language": "Hindi", - "copyright_text": "(P) 2003 Sony Music Entertainment India Pvt. Ltd.", - "has_lyrics": "false", - "lyrics": null, - "media_url": "https://aac.saavncdn.com/909/b34c95486eb42ede300a549da19a38ad_160.mp4", - "media_urls": { - "96_KBPS": "https://aac.saavncdn.com/909/b34c95486eb42ede300a549da19a38ad_96.mp4", - "160_KBPS": "https://aac.saavncdn.com/909/b34c95486eb42ede300a549da19a38ad_160.mp4", - "320_KBPS": "https://aac.saavncdn.com/909/b34c95486eb42ede300a549da19a38ad_320.mp4" - }, - "release_date": "2003-09-20", - "url": { - "song": "https://www.jiosaavn.com/song/kal-ho-naa-ho/QjAnWgYCcFc", - "album": "https://www.jiosaavn.com/album/kal-ho-naa-ho-original-motion-picture-soundtrack/wxleSiR74Dg_" - } - }, - { - "id": "lULDgPcz", - "song": "Main Hoon Na", - "album": "Main Hoon Na", - "year": "2004", - "primary_artists": [ - "Sonu Nigam", - "Shreya Ghoshal" - ], - "singers": [ - "Sonu Nigam", - "Shreya Ghoshal" - ], - "image": "https://c.saavncdn.com/388/Main-Hoon-Na-Hindi-2004-500x500.jpg", - "images": { - "50x50": "https://c.saavncdn.com/388/Main-Hoon-Na-Hindi-2004-50x50.jpg", - "150x150": "https://c.saavncdn.com/388/Main-Hoon-Na-Hindi-2004-150x150.jpg", - "500x500": "https://c.saavncdn.com/388/Main-Hoon-Na-Hindi-2004-500x500.jpg" - }, - "duration": "361", - "label": "", - "albumid": "1037222", - "language": "Hindi", - "copyright_text": "© 2004 ", - "has_lyrics": "true", - "lyrics": null, - "media_url": "https://aac.saavncdn.com/388/348841a9282b5b362526a8098a7f4491_160.mp4", - "media_urls": { - "96_KBPS": "https://aac.saavncdn.com/388/348841a9282b5b362526a8098a7f4491_96.mp4", - "160_KBPS": "https://aac.saavncdn.com/388/348841a9282b5b362526a8098a7f4491_160.mp4", - "320_KBPS": "https://aac.saavncdn.com/388/348841a9282b5b362526a8098a7f4491_320.mp4" - }, - "release_date": "2004-02-27", - "url": { - "song": "https://www.jiosaavn.com/song/main-hoon-na/HD0ndRNgVEk", - "album": "https://www.jiosaavn.com/album/main-hoon-na/Gf2uDkAyAkg_" - } - }, - { - "id": "jFerJMnc", - "song": "Koi Mil Gaya", - "album": "Kuch Kuch Hota Hai (Original Motion Picture Soundtrack)", - "year": "1998", - "primary_artists": [ - "Jatin-Lalit", - "Kavita Krishnamurthy", - "Udit Narayan", - "Alka Yagnik" - ], - "singers": [ - "Jatin-Lalit", - "Kavita Krishnamurthy", - "Udit Narayan", - "Alka Yagnik" - ], - "image": "https://c.saavncdn.com/907/Kuch-Kuch-Hota-Hai-Hindi-1998-20190516130035-500x500.jpg", - "images": { - "50x50": "https://c.saavncdn.com/907/Kuch-Kuch-Hota-Hai-Hindi-1998-20190516130035-50x50.jpg", - "150x150": "https://c.saavncdn.com/907/Kuch-Kuch-Hota-Hai-Hindi-1998-20190516130035-150x150.jpg", - "500x500": "https://c.saavncdn.com/907/Kuch-Kuch-Hota-Hai-Hindi-1998-20190516130035-500x500.jpg" - }, - "duration": "437", - "label": "Sony Music Entertainment India Pvt. Ltd.", - "albumid": "1035265", - "language": "Hindi", - "copyright_text": "(P) 1998 Sony Music Entertainment India Pvt. Ltd.", - "has_lyrics": "false", - "lyrics": null, - "media_url": "https://aac.saavncdn.com/907/2d22f49ec5435c9d606742ae2648a5a2_160.mp4", - "media_urls": { - "96_KBPS": "https://aac.saavncdn.com/907/2d22f49ec5435c9d606742ae2648a5a2_96.mp4", - "160_KBPS": "https://aac.saavncdn.com/907/2d22f49ec5435c9d606742ae2648a5a2_160.mp4", - "320_KBPS": "https://aac.saavncdn.com/907/2d22f49ec5435c9d606742ae2648a5a2_320.mp4" - }, - "release_date": "1998-08-19", - "url": { - "song": "https://www.jiosaavn.com/song/koi-mil-gaya/Gi4OQz59WVA", - "album": "https://www.jiosaavn.com/album/kuch-kuch-hota-hai-original-motion-picture-soundtrack/zvqnBMKjQeM_" - } - }, - ] + "id": "268477478", + "listname": "90's Love", + "username": "", + "listCount": "17", + "playlistUrl": "https://www.jiosaavn.com/s/playlist/88063878238ad9a391a33c0e628d2b01/90s_Love/OykxHSA0YytFo9wdEAzFBA__", + "image": "https://pli.saavncdn.com/74/78/268477478.jpg?bch=1555760417", + "songs": [ + { + "id": "2XLkr2Gd", + "songName": "Kal Ho Naa Ho", + "albumName": "Kal Ho Naa Ho (Original Motion Picture Soundtrack)", + "albumId": "1208084", + "playCount": "22559746", + "duration": "321", + "label": "Sony Music Entertainment India Pvt. Ltd.", + "primaryArtists": "Shankar-Ehsaan-Loy, Sonu Nigam", + "primaryArtistsId": "455280, 455125", + "featuredArtists": "", + "featuredArtistsId": "", + "singers": "Shankar-Ehsaan-Loy, Sonu Nigam", + "starring": "Shah Rukh Khan, Preity Zinta, Saif Ali Khan, Jaya Bachchan", + "language": "Hindi", + "copyright": "(P) 2003 Sony Music Entertainment India Pvt. Ltd.", + "hasLyrics": "false", + "lyrics": null, + "releaseDate": "2003-09-20", + "songUrl": "https://www.jiosaavn.com/song/kal-ho-naa-ho/QjAnWgYCcFc", + "albumUrl": "https://www.jiosaavn.com/album/kal-ho-naa-ho-original-motion-picture-soundtrack/wxleSiR74Dg_", + "imagesUrls": { + "50x50": "https://c.saavncdn.com/909/Kal-Ho-Naa-Ho-Hindi-2003-50x50.jpg", + "150x150": "https://c.saavncdn.com/909/Kal-Ho-Naa-Ho-Hindi-2003-150x150.jpg", + "500x500": "https://c.saavncdn.com/909/Kal-Ho-Naa-Ho-Hindi-2003-500x500.jpg" + }, + "audioUrls": { + "96_KBPS": "https://aac.saavncdn.com/909/b34c95486eb42ede300a549da19a38ad_96.mp4", + "160_KBPS": "https://aac.saavncdn.com/909/b34c95486eb42ede300a549da19a38ad_160.mp4", + "320_KBPS": "https://aac.saavncdn.com/909/b34c95486eb42ede300a549da19a38ad_320.mp4" + }, + "labelUrl": "https://www.jiosaavn.com/label/sony-music-entertainment-india-pvt.-ltd.-albums/LaFAA6h1q2U_" + }, + { + "id": "lULDgPcz", + "songName": "Main Hoon Na", + "albumName": "Main Hoon Na", + "albumId": "1037222", + "playCount": "12003605", + "duration": "361", + "label": "", + "primaryArtists": "Sonu Nigam, Shreya Ghoshal", + "primaryArtistsId": "455125, 455130", + "featuredArtists": "", + "featuredArtistsId": "", + "singers": "Sonu Nigam, Shreya Ghoshal", + "starring": "Shah Rukh Khan, Suniel Shetty, Susmit Sen, Zayed Khan, Amrita Rao", + "language": "Hindi", + "copyright": "© 2004 ", + "hasLyrics": "true", + "lyrics": null, + "releaseDate": "2004-02-27", + "songUrl": "https://www.jiosaavn.com/song/main-hoon-na/HD0ndRNgVEk", + "albumUrl": "https://www.jiosaavn.com/album/main-hoon-na/Gf2uDkAyAkg_", + "imagesUrls": { + "50x50": "https://c.saavncdn.com/388/Main-Hoon-Na-Hindi-2004-50x50.jpg", + "150x150": "https://c.saavncdn.com/388/Main-Hoon-Na-Hindi-2004-150x150.jpg", + "500x500": "https://c.saavncdn.com/388/Main-Hoon-Na-Hindi-2004-500x500.jpg" + }, + "audioUrls": { + "96_KBPS": "https://aac.saavncdn.com/388/348841a9282b5b362526a8098a7f4491_96.mp4", + "160_KBPS": "https://aac.saavncdn.com/388/348841a9282b5b362526a8098a7f4491_160.mp4", + "320_KBPS": "https://aac.saavncdn.com/388/348841a9282b5b362526a8098a7f4491_320.mp4" + }, + "labelUrl": "https://www.jiosaavn.com/label/-albums/6DLuXO3VoTo_" + }, + { + "id": "jFerJMnc", + "songName": "Koi Mil Gaya", + "albumName": "Kuch Kuch Hota Hai (Original Motion Picture Soundtrack)", + "albumId": "1035265", + "playCount": "15982751", + "duration": "437", + "label": "Sony Music Entertainment India Pvt. Ltd.", + "primaryArtists": "Jatin-Lalit, Kavita Krishnamurti Subramaniam, Udit Narayan, Alka Yagnik", + "primaryArtistsId": "455534, 455158, 455127, 455120", + "featuredArtists": "", + "featuredArtistsId": "", + "singers": "Jatin-Lalit, Kavita Krishnamurti Subramaniam, Udit Narayan, Alka Yagnik", + "starring": "Shah Rukh Khan, Kajol, Rani Mukerji, Salman Khan", + "language": "Hindi", + "copyright": "(P) 1998 Sony Music Entertainment India Pvt. Ltd.", + "hasLyrics": "false", + "lyrics": null, + "releaseDate": "1998-08-19", + "songUrl": "https://www.jiosaavn.com/song/koi-mil-gaya/Gi4OQz59WVA", + "albumUrl": "https://www.jiosaavn.com/album/kuch-kuch-hota-hai-original-motion-picture-soundtrack/zvqnBMKjQeM_", + "imagesUrls": { + "50x50": "https://c.saavncdn.com/907/Kuch-Kuch-Hota-Hai-Hindi-1998-20190516130035-50x50.jpg", + "150x150": "https://c.saavncdn.com/907/Kuch-Kuch-Hota-Hai-Hindi-1998-20190516130035-150x150.jpg", + "500x500": "https://c.saavncdn.com/907/Kuch-Kuch-Hota-Hai-Hindi-1998-20190516130035-500x500.jpg" + }, + "audioUrls": { + "96_KBPS": "https://aac.saavncdn.com/907/2d22f49ec5435c9d606742ae2648a5a2_96.mp4", + "160_KBPS": "https://aac.saavncdn.com/907/2d22f49ec5435c9d606742ae2648a5a2_160.mp4", + "320_KBPS": "https://aac.saavncdn.com/907/2d22f49ec5435c9d606742ae2648a5a2_320.mp4" + }, + "labelUrl": "https://www.jiosaavn.com/label/sony-music-entertainment-india-pvt.-ltd.-albums/LaFAA6h1q2U_" + }, + { + "id": "U3wEEo6F", + "songName": "Tujhe Dekha To", + "albumName": "Dilwale Dulhania Le Jayenge", + "albumId": "1120992", + "playCount": "101871236", + "duration": "303", + "label": "Saregama", + "primaryArtists": "Lata Mangeshkar, Kumar Sanu", + "primaryArtistsId": "455109, 455142", + "featuredArtists": "", + "featuredArtistsId": "", + "singers": "Lata Mangeshkar, Kumar Sanu", + "starring": "Shah Rukh Khan, Kajol, Anupam Kher, Amrish Puri, Farida Jalal, Satish Shah, Achala Sachdev, Mandira Bedi, Karan Johar", + "language": "Hindi", + "copyright": "© 1995 Saregama", + "hasLyrics": "true", + "lyrics": null, + "releaseDate": "1995-10-20", + "songUrl": "https://www.jiosaavn.com/song/tujhe-dekha-to/JVscdDFfAXU", + "albumUrl": "https://www.jiosaavn.com/album/dilwale-dulhania-le-jayenge/IL9HglkwPtk_", + "imagesUrls": { + "50x50": "https://c.saavncdn.com/588/Dilwale-Dulhania-Le-Jayenge-Hindi-1995-20171114-50x50.jpg", + "150x150": "https://c.saavncdn.com/588/Dilwale-Dulhania-Le-Jayenge-Hindi-1995-20171114-150x150.jpg", + "500x500": "https://c.saavncdn.com/588/Dilwale-Dulhania-Le-Jayenge-Hindi-1995-20171114-500x500.jpg" + }, + "audioUrls": { + "96_KBPS": "https://aac.saavncdn.com/588/1915cd0934f79eeb646ffebde384e59d_96.mp4", + "160_KBPS": "https://aac.saavncdn.com/588/1915cd0934f79eeb646ffebde384e59d_160.mp4", + "320_KBPS": "https://aac.saavncdn.com/588/1915cd0934f79eeb646ffebde384e59d_320.mp4" + }, + "labelUrl": "https://www.jiosaavn.com/label/saregama-albums/MNccah3udrQ_" + }, + { + "id": "rtdvmBBB", + "songName": "Kuch Kuch Hota Hai", + "albumName": "Kuch Kuch Hota Hai (Original Motion Picture Soundtrack)", + "albumId": "1035265", + "playCount": "37765129", + "duration": "297", + "label": "Sony Music Entertainment India Pvt. Ltd.", + "primaryArtists": "Jatin-Lalit, Udit Narayan", + "primaryArtistsId": "455534, 455127", + "featuredArtists": "", + "featuredArtistsId": "", + "singers": "Jatin-Lalit, Udit Narayan, Alka Yagnik", + "starring": "Shah Rukh Khan, Kajol, Rani Mukerji, Salman Khan", + "language": "Hindi", + "copyright": "(P) 1998 Sony Music Entertainment India Pvt. Ltd.", + "hasLyrics": "false", + "lyrics": null, + "releaseDate": "1998-08-19", + "songUrl": "https://www.jiosaavn.com/song/kuch-kuch-hota-hai/AhwPRxlydXE", + "albumUrl": "https://www.jiosaavn.com/album/kuch-kuch-hota-hai-original-motion-picture-soundtrack/zvqnBMKjQeM_", + "imagesUrls": { + "50x50": "https://c.saavncdn.com/907/Kuch-Kuch-Hota-Hai-Hindi-1998-20190516130035-50x50.jpg", + "150x150": "https://c.saavncdn.com/907/Kuch-Kuch-Hota-Hai-Hindi-1998-20190516130035-150x150.jpg", + "500x500": "https://c.saavncdn.com/907/Kuch-Kuch-Hota-Hai-Hindi-1998-20190516130035-500x500.jpg" + }, + "audioUrls": { + "96_KBPS": "https://aac.saavncdn.com/907/f7bbb1a1ce5af61c560fc4795d2beec9_96.mp4", + "160_KBPS": "https://aac.saavncdn.com/907/f7bbb1a1ce5af61c560fc4795d2beec9_160.mp4", + "320_KBPS": "https://aac.saavncdn.com/907/f7bbb1a1ce5af61c560fc4795d2beec9_320.mp4" + }, + "labelUrl": "https://www.jiosaavn.com/label/sony-music-entertainment-india-pvt.-ltd.-albums/LaFAA6h1q2U_" + }, + { + "id": "WdqMxZ6u", + "songName": "Chand Sifarish", + "albumName": "Fanaa", + "albumId": "1027146", + "playCount": "21457062", + "duration": "275", + "label": "YRF Music", + "primaryArtists": "Shaan, Kailash Kher, Jatin-Lalit, Prasoon Joshi", + "primaryArtistsId": "455135, 455425, 455534, 456278", + "featuredArtists": "", + "featuredArtistsId": "", + "singers": "Shaan, Kailash Kher", + "starring": "Aamir Khan, Kajol, Rishi Kapoor, Kirron Kher, Sharat Saxena, Tabu", + "language": "Hindi", + "copyright": "© 2006 YRF Music", + "hasLyrics": "true", + "lyrics": null, + "releaseDate": "2006-05-26", + "songUrl": "https://www.jiosaavn.com/song/chand-sifarish/JwwafAxqAUY", + "albumUrl": "https://www.jiosaavn.com/album/fanaa/k,TIgv1ORbc_", + "imagesUrls": { + "50x50": "https://c.saavncdn.com/146/Fanaa-Hindi-2006-20190329181154-50x50.jpg", + "150x150": "https://c.saavncdn.com/146/Fanaa-Hindi-2006-20190329181154-150x150.jpg", + "500x500": "https://c.saavncdn.com/146/Fanaa-Hindi-2006-20190329181154-500x500.jpg" + }, + "audioUrls": { + "96_KBPS": "https://aac.saavncdn.com/146/53c9ccea6717dc94d957d1f1f5163723_96.mp4", + "160_KBPS": "https://aac.saavncdn.com/146/53c9ccea6717dc94d957d1f1f5163723_160.mp4", + "320_KBPS": "https://aac.saavncdn.com/146/53c9ccea6717dc94d957d1f1f5163723_320.mp4" + }, + "labelUrl": "https://www.jiosaavn.com/label/yrf-music-albums/XqFShgT4cps_" + }, + { + "id": "nrt-2lCH", + "songName": "Kaho Naa Pyar Hai - Happy", + "albumName": "Kaho Naa Pyar Hai", + "albumId": "1065819", + "playCount": "22156513", + "duration": "424", + "label": "Saregama", + "primaryArtists": "Udit Narayan, Alka Yagnik", + "primaryArtistsId": "455127, 455120", + "featuredArtists": "", + "featuredArtistsId": "", + "singers": "", + "starring": "", + "language": "Hindi", + "copyright": "℗ 2000 Saregama India Ltd", + "hasLyrics": "true", + "lyrics": null, + "releaseDate": "2000-01-14", + "songUrl": "https://www.jiosaavn.com/song/kaho-naa-pyar-hai---happy/HhofHEZcdHs", + "albumUrl": "https://www.jiosaavn.com/album/kaho-naa-pyar-hai/Ubn5MgPXop0_", + "imagesUrls": { + "50x50": "https://c.saavncdn.com/446/Kaho-Naa-Pyar-Hai-Hindi-2000-20200901153916-50x50.jpg", + "150x150": "https://c.saavncdn.com/446/Kaho-Naa-Pyar-Hai-Hindi-2000-20200901153916-150x150.jpg", + "500x500": "https://c.saavncdn.com/446/Kaho-Naa-Pyar-Hai-Hindi-2000-20200901153916-500x500.jpg" + }, + "audioUrls": { + "96_KBPS": "https://aac.saavncdn.com/446/b9e40ccc02bc6003d19cbeea7b94f999_96.mp4", + "160_KBPS": "https://aac.saavncdn.com/446/b9e40ccc02bc6003d19cbeea7b94f999_160.mp4", + "320_KBPS": "https://aac.saavncdn.com/446/b9e40ccc02bc6003d19cbeea7b94f999_320.mp4" + }, + "labelUrl": "https://www.jiosaavn.com/label/saregama-albums/MNccah3udrQ_" + }, + { + "id": "XoM84Oe0", + "songName": "Na Tum Jano Na Hum", + "albumName": "Kaho Naa Pyar Hai", + "albumId": "1065819", + "playCount": "8870487", + "duration": "383", + "label": "Saregama", + "primaryArtists": "Lucky Ali, Ramya NSK, Ramya", + "primaryArtistsId": "458663, 489109, 8558530", + "featuredArtists": "", + "featuredArtistsId": "", + "singers": "Ramya NSK", + "starring": "", + "language": "Hindi", + "copyright": "℗ 2000 Saregama India Ltd", + "hasLyrics": "true", + "lyrics": null, + "releaseDate": "2000-01-14", + "songUrl": "https://www.jiosaavn.com/song/na-tum-jano-na-hum/KAcmCUB-UgM", + "albumUrl": "https://www.jiosaavn.com/album/kaho-naa-pyar-hai/Ubn5MgPXop0_", + "imagesUrls": { + "50x50": "https://c.saavncdn.com/446/Kaho-Naa-Pyar-Hai-Hindi-2000-20200901153916-50x50.jpg", + "150x150": "https://c.saavncdn.com/446/Kaho-Naa-Pyar-Hai-Hindi-2000-20200901153916-150x150.jpg", + "500x500": "https://c.saavncdn.com/446/Kaho-Naa-Pyar-Hai-Hindi-2000-20200901153916-500x500.jpg" + }, + "audioUrls": { + "96_KBPS": "https://aac.saavncdn.com/446/aa1ccf11169c840b47b2fcff5965cb9b_96.mp4", + "160_KBPS": "https://aac.saavncdn.com/446/aa1ccf11169c840b47b2fcff5965cb9b_160.mp4", + "320_KBPS": "https://aac.saavncdn.com/446/aa1ccf11169c840b47b2fcff5965cb9b_320.mp4" + }, + "labelUrl": "https://www.jiosaavn.com/label/saregama-albums/MNccah3udrQ_" + }, + { + "id": "NTBW-riy", + "songName": "Ek Ladki Ko Dekha", + "albumName": "1942 A Love Story", + "albumId": "2616633", + "playCount": "47818632", + "duration": "275", + "label": "Saregama", + "primaryArtists": "Kumar Sanu", + "primaryArtistsId": "455142", + "featuredArtists": "", + "featuredArtistsId": "", + "singers": "", + "starring": "", + "language": "Hindi", + "copyright": "℗ 1994 Saregama India Ltd", + "hasLyrics": "false", + "lyrics": null, + "releaseDate": "1994-12-31", + "songUrl": "https://www.jiosaavn.com/song/ek-ladki-ko-dekha/PjwpZllCXko", + "albumUrl": "https://www.jiosaavn.com/album/1942-a-love-story/QzB7uLA5Nc8_", + "imagesUrls": { + "50x50": "https://c.saavncdn.com/767/1942-A-Love-Story-Bengali-1994-20200904083912-50x50.jpg", + "150x150": "https://c.saavncdn.com/767/1942-A-Love-Story-Bengali-1994-20200904083912-150x150.jpg", + "500x500": "https://c.saavncdn.com/767/1942-A-Love-Story-Bengali-1994-20200904083912-500x500.jpg" + }, + "audioUrls": { + "96_KBPS": "https://aac.saavncdn.com/023/3e92eef0ab01146c3aadc64dc1f367e3_96.mp4", + "160_KBPS": "https://aac.saavncdn.com/023/3e92eef0ab01146c3aadc64dc1f367e3_160.mp4", + "320_KBPS": "https://aac.saavncdn.com/023/3e92eef0ab01146c3aadc64dc1f367e3_320.mp4" + }, + "labelUrl": "https://www.jiosaavn.com/label/saregama-albums/MNccah3udrQ_" + }, + { + "id": "kaO__nHs", + "songName": "Ek Pal Ka Jeena", + "albumName": "Kaho Naa Pyar Hai", + "albumId": "1065819", + "playCount": "7032530", + "duration": "397", + "label": "Saregama", + "primaryArtists": "Lucky Ali", + "primaryArtistsId": "458663", + "featuredArtists": "", + "featuredArtistsId": "", + "singers": "", + "starring": "", + "language": "Hindi", + "copyright": "℗ 2000 Saregama India Ltd", + "hasLyrics": "false", + "lyrics": null, + "releaseDate": "2000-01-14", + "songUrl": "https://www.jiosaavn.com/song/ek-pal-ka-jeena/Gwkkbitef0A", + "albumUrl": "https://www.jiosaavn.com/album/kaho-naa-pyar-hai/Ubn5MgPXop0_", + "imagesUrls": { + "50x50": "https://c.saavncdn.com/446/Kaho-Naa-Pyar-Hai-Hindi-2000-20200901153916-50x50.jpg", + "150x150": "https://c.saavncdn.com/446/Kaho-Naa-Pyar-Hai-Hindi-2000-20200901153916-150x150.jpg", + "500x500": "https://c.saavncdn.com/446/Kaho-Naa-Pyar-Hai-Hindi-2000-20200901153916-500x500.jpg" + }, + "audioUrls": { + "96_KBPS": "https://aac.saavncdn.com/446/3842602eecfe24f9b5ac07b893d6ebde_96.mp4", + "160_KBPS": "https://aac.saavncdn.com/446/3842602eecfe24f9b5ac07b893d6ebde_160.mp4", + "320_KBPS": "https://aac.saavncdn.com/446/3842602eecfe24f9b5ac07b893d6ebde_320.mp4" + }, + "labelUrl": "https://www.jiosaavn.com/label/saregama-albums/MNccah3udrQ_" + }, + { + "id": "oGwjH99j", + "songName": "Urvashi Urvashi", + "albumName": "Hum Se Hai Muqabala - Kadalan", + "albumId": "1030440", + "playCount": "4022380", + "duration": "381", + "label": "Ishtar Music Pvt. Ltd.", + "primaryArtists": "A.R. Rahman, Shankar Mahadevan, Noel James", + "primaryArtistsId": "456269, 455275, 465106", + "featuredArtists": "", + "featuredArtistsId": "", + "singers": "A.R. Rahman, Shankar Mahadevan, Noel James", + "starring": "", + "language": "Hindi", + "copyright": "© 1995 Ishtar Music Pvt. Ltd.", + "hasLyrics": "true", + "lyrics": null, + "releaseDate": "1995-03-01", + "songUrl": "https://www.jiosaavn.com/song/urvashi-urvashi/Hy8cWzwJDlk", + "albumUrl": "https://www.jiosaavn.com/album/hum-se-hai-muqabala---kadalan/6ERJ58loulU_", + "imagesUrls": { + "50x50": "https://c.saavncdn.com/081/Hum-Se-Hai-Muqabala-Kadalan-Hindi-1995-20211126170542-50x50.jpg", + "150x150": "https://c.saavncdn.com/081/Hum-Se-Hai-Muqabala-Kadalan-Hindi-1995-20211126170542-150x150.jpg", + "500x500": "https://c.saavncdn.com/081/Hum-Se-Hai-Muqabala-Kadalan-Hindi-1995-20211126170542-500x500.jpg" + }, + "audioUrls": { + "96_KBPS": "https://aac.saavncdn.com/440/bdbc73d95d132ca02fb3ca37ee79a7ab_96.mp4", + "160_KBPS": "https://aac.saavncdn.com/440/bdbc73d95d132ca02fb3ca37ee79a7ab_160.mp4", + "320_KBPS": "https://aac.saavncdn.com/440/bdbc73d95d132ca02fb3ca37ee79a7ab_320.mp4" + }, + "labelUrl": "https://www.jiosaavn.com/label/ishtar-music-pvt.-ltd.-albums/zUyefLXpY-M_" + }, + { + "id": "qFSo3L4m", + "songName": "Aati Kya Khandala", + "albumName": "Ghulam", + "albumId": "1028040", + "playCount": "4569000", + "duration": "252", + "label": "Tips Music", + "primaryArtists": "Aamir Khan, Alka Yagnik", + "primaryArtistsId": "455463, 455120", + "featuredArtists": "", + "featuredArtistsId": "", + "singers": "Aamir Khan, Alka Yagnik", + "starring": "Aamir Khan, Rani Mukerji", + "language": "Hindi", + "copyright": "© 1998 Tips Industries Ltd.", + "hasLyrics": "true", + "lyrics": null, + "releaseDate": "1998-03-08", + "songUrl": "https://www.jiosaavn.com/song/aati-kya-khandala/AS44Xkd8A14", + "albumUrl": "https://www.jiosaavn.com/album/ghulam/jdczLfCD0ec_", + "imagesUrls": { + "50x50": "https://c.saavncdn.com/599/Ghulam-Hindi-1998-20190816135120-50x50.jpg", + "150x150": "https://c.saavncdn.com/599/Ghulam-Hindi-1998-20190816135120-150x150.jpg", + "500x500": "https://c.saavncdn.com/599/Ghulam-Hindi-1998-20190816135120-500x500.jpg" + }, + "audioUrls": { + "96_KBPS": "https://aac.saavncdn.com/599/191e10a590f1eaaa69ca5d947410b84d_96.mp4", + "160_KBPS": "https://aac.saavncdn.com/599/191e10a590f1eaaa69ca5d947410b84d_160.mp4", + "320_KBPS": "https://aac.saavncdn.com/599/191e10a590f1eaaa69ca5d947410b84d_320.mp4" + }, + "labelUrl": "https://www.jiosaavn.com/label/tips-music-albums/WyMes45YplY_" + }, + { + "id": "TX73Q0ZS", + "songName": "Pehla Nasha", + "albumName": "Jo Jeeta Wohi Sikandar", + "albumId": "2616666", + "playCount": "47200441", + "duration": "293", + "label": "Saregama", + "primaryArtists": "Udit Narayan, Sadhana Sargam", + "primaryArtistsId": "455127, 455324", + "featuredArtists": "", + "featuredArtistsId": "", + "singers": "Udit Narayan, Sadhana Sargam", + "starring": "Aamir Khan, Ayesha Jhulka", + "language": "Hindi", + "copyright": "© 1992 Saregama", + "hasLyrics": "true", + "lyrics": null, + "releaseDate": "1992-05-22", + "songUrl": "https://www.jiosaavn.com/song/pehla-nasha/JDBcAiUAbWA", + "albumUrl": "https://www.jiosaavn.com/album/jo-jeeta-wohi-sikandar/CFif-rUStSc_", + "imagesUrls": { + "50x50": "https://c.saavncdn.com/852/Jo-Jeeta-Wohi-Sikandar-Hindi-1992-50x50.jpg", + "150x150": "https://c.saavncdn.com/852/Jo-Jeeta-Wohi-Sikandar-Hindi-1992-150x150.jpg", + "500x500": "https://c.saavncdn.com/852/Jo-Jeeta-Wohi-Sikandar-Hindi-1992-500x500.jpg" + }, + "audioUrls": { + "96_KBPS": "https://aac.saavncdn.com/852/9d335ee08b26f171a3d65e11f8819d52_96.mp4", + "160_KBPS": "https://aac.saavncdn.com/852/9d335ee08b26f171a3d65e11f8819d52_160.mp4", + "320_KBPS": "https://aac.saavncdn.com/852/9d335ee08b26f171a3d65e11f8819d52_320.mp4" + }, + "labelUrl": "https://www.jiosaavn.com/label/saregama-albums/MNccah3udrQ_" + }, + { + "id": "uzpge8Vj", + "songName": "O O Jaane Jaana", + "albumName": "Pyaar Kiya To Darna Kya", + "albumId": "1043832", + "playCount": "8633896", + "duration": "345", + "label": "", + "primaryArtists": "Kamaal Khan", + "primaryArtistsId": "455141", + "featuredArtists": "", + "featuredArtistsId": "", + "singers": "Kamaal Khan", + "starring": "", + "language": "Hindi", + "copyright": "© 1998 Super Cassettes Industries Private Limited", + "hasLyrics": "true", + "lyrics": null, + "releaseDate": "1998-03-10", + "songUrl": "https://www.jiosaavn.com/song/o-o-jaane-jaana/BRIbVhEIYVk", + "albumUrl": "https://www.jiosaavn.com/album/pyaar-kiya-to-darna-kya/m7i93n2FxtE_", + "imagesUrls": { + "50x50": "https://c.saavncdn.com/832/Pyaar-Kiya-To-Darna-Kya-1998-50x50.jpg", + "150x150": "https://c.saavncdn.com/832/Pyaar-Kiya-To-Darna-Kya-1998-150x150.jpg", + "500x500": "https://c.saavncdn.com/832/Pyaar-Kiya-To-Darna-Kya-1998-500x500.jpg" + }, + "audioUrls": { + "96_KBPS": "https://aac.saavncdn.com/832/18f1ee631cedaeea614c43ef4f48a3c2_96.mp4", + "160_KBPS": "https://aac.saavncdn.com/832/18f1ee631cedaeea614c43ef4f48a3c2_160.mp4", + "320_KBPS": "https://aac.saavncdn.com/832/18f1ee631cedaeea614c43ef4f48a3c2_320.mp4" + }, + "labelUrl": "https://www.jiosaavn.com/label/-albums/6DLuXO3VoTo_" + }, + { + "id": "FOn06quY", + "songName": "Ladki Badi Anjani Hai", + "albumName": "Kuch Kuch Hota Hai (Original Motion Picture Soundtrack)", + "albumId": "1035265", + "playCount": "23709319", + "duration": "381", + "label": "Sony Music Entertainment India Pvt. Ltd.", + "primaryArtists": "Jatin-Lalit, Kumar Sanu, Alka Yagnik", + "primaryArtistsId": "455534, 455142, 455120", + "featuredArtists": "", + "featuredArtistsId": "", + "singers": "Jatin-Lalit, Kumar Sanu, Alka Yagnik", + "starring": "Shah Rukh Khan, Kajol, Rani Mukerji, Salman Khan", + "language": "Hindi", + "copyright": "(P) 1998 Sony Music Entertainment India Pvt. Ltd. .", + "hasLyrics": "false", + "lyrics": null, + "releaseDate": "1998-08-19", + "songUrl": "https://www.jiosaavn.com/song/ladki-badi-anjani-hai/NicFAUJBQmo", + "albumUrl": "https://www.jiosaavn.com/album/kuch-kuch-hota-hai-original-motion-picture-soundtrack/zvqnBMKjQeM_", + "imagesUrls": { + "50x50": "https://c.saavncdn.com/907/Kuch-Kuch-Hota-Hai-Hindi-1998-20190516130035-50x50.jpg", + "150x150": "https://c.saavncdn.com/907/Kuch-Kuch-Hota-Hai-Hindi-1998-20190516130035-150x150.jpg", + "500x500": "https://c.saavncdn.com/907/Kuch-Kuch-Hota-Hai-Hindi-1998-20190516130035-500x500.jpg" + }, + "audioUrls": { + "96_KBPS": "https://aac.saavncdn.com/907/08a005b0d0d1a09b5532b4547b3e9fe3_96.mp4", + "160_KBPS": "https://aac.saavncdn.com/907/08a005b0d0d1a09b5532b4547b3e9fe3_160.mp4", + "320_KBPS": "https://aac.saavncdn.com/907/08a005b0d0d1a09b5532b4547b3e9fe3_320.mp4" + }, + "labelUrl": "https://www.jiosaavn.com/label/sony-music-entertainment-india-pvt.-ltd.-albums/LaFAA6h1q2U_" + }, + { + "id": "Hr3D2hLT", + "songName": "Do Dil \r\nMil Rahe Hai", + "albumName": "Pardes", + "albumId": "1042394", + "playCount": "30964642", + "duration": "400", + "label": "Tips Music", + "primaryArtists": "Kumar Sanu", + "primaryArtistsId": "455142", + "featuredArtists": "", + "featuredArtistsId": "", + "singers": "Kumar Sanu", + "starring": "Shah Rukh Khan, Mahima Chaudhry", + "language": "Hindi", + "copyright": "© 1997 Tips Industries Ltd.", + "hasLyrics": "true", + "lyrics": null, + "releaseDate": "1997-08-08", + "songUrl": "https://www.jiosaavn.com/song/do-dil-mil-rahe-hai/OBpYdUZYe2c", + "albumUrl": "https://www.jiosaavn.com/album/pardes/aT,ino5A3f8_", + "imagesUrls": { + "50x50": "https://c.saavncdn.com/386/Pardes-Hindi-1997-20200116121055-50x50.jpg", + "150x150": "https://c.saavncdn.com/386/Pardes-Hindi-1997-20200116121055-150x150.jpg", + "500x500": "https://c.saavncdn.com/386/Pardes-Hindi-1997-20200116121055-500x500.jpg" + }, + "audioUrls": { + "96_KBPS": "https://aac.saavncdn.com/386/64f60d5bbf97767026dd2f027a1088a3_96.mp4", + "160_KBPS": "https://aac.saavncdn.com/386/64f60d5bbf97767026dd2f027a1088a3_160.mp4", + "320_KBPS": "https://aac.saavncdn.com/386/64f60d5bbf97767026dd2f027a1088a3_320.mp4" + }, + "labelUrl": "https://www.jiosaavn.com/label/tips-music-albums/WyMes45YplY_" + }, + { + "id": "dV6hFKL0", + "songName": "Chand Sitare", + "albumName": "Kaho Naa Pyar Hai", + "albumId": "1065819", + "playCount": "10571852", + "duration": "398", + "label": "Saregama", + "primaryArtists": "Kumar Sanu", + "primaryArtistsId": "455142", + "featuredArtists": "", + "featuredArtistsId": "", + "singers": "", + "starring": "", + "language": "Hindi", + "copyright": "℗ 2000 Saregama India Ltd", + "hasLyrics": "false", + "lyrics": null, + "releaseDate": "2000-01-14", + "songUrl": "https://www.jiosaavn.com/song/chand-sitare/FD5dWTJ7ewM", + "albumUrl": "https://www.jiosaavn.com/album/kaho-naa-pyar-hai/Ubn5MgPXop0_", + "imagesUrls": { + "50x50": "https://c.saavncdn.com/446/Kaho-Naa-Pyar-Hai-Hindi-2000-20200901153916-50x50.jpg", + "150x150": "https://c.saavncdn.com/446/Kaho-Naa-Pyar-Hai-Hindi-2000-20200901153916-150x150.jpg", + "500x500": "https://c.saavncdn.com/446/Kaho-Naa-Pyar-Hai-Hindi-2000-20200901153916-500x500.jpg" + }, + "audioUrls": { + "96_KBPS": "https://aac.saavncdn.com/446/bf3ab64cfa250f2e1ba1f2a3c3c9d127_96.mp4", + "160_KBPS": "https://aac.saavncdn.com/446/bf3ab64cfa250f2e1ba1f2a3c3c9d127_160.mp4", + "320_KBPS": "https://aac.saavncdn.com/446/bf3ab64cfa250f2e1ba1f2a3c3c9d127_320.mp4" + }, + "labelUrl": "https://www.jiosaavn.com/label/saregama-albums/MNccah3udrQ_" + } + ] } ``` diff --git a/setup.py b/setup.py index 1b2cb70..baf5cdd 100644 --- a/setup.py +++ b/setup.py @@ -6,18 +6,18 @@ setup( - name = 'JioSaavn', - packages = ['JioSaavn'], + name = 'jiosaavn', + packages = ['jiosaavn'], version = 'v0.0.4', license='MIT', - description = 'Search for JioSaavn songs & album. Get song ,album & lyric information.', + description = 'Search for JioSaavn songs & album. Get song ,album, lyric & playlist information from url or id.', long_description=long_description, long_description_content_type="text/markdown", author = 'vidya sagar', author_email = 'svidya051@gmail.com', - url = 'https://github.com/vidyasagar1432/JioSaavn', + url = 'https://github.com/vidyasagar1432/jiosaavn', # download_url = '', - keywords = ['jiosaavn', 'jiosaavnapi', 'songs', 'albums', 'lyrics'], + keywords = ['jiosaavn', 'jio-saavn-api','jio-saavn','playlist','aiohttp', 'songs', 'albums', 'lyrics'], install_requires=[ 'aiohttp', 'pydantic', diff --git a/test.py b/test.py index b8cc105..65acbbf 100644 --- a/test.py +++ b/test.py @@ -1,21 +1,27 @@ import asyncio -from JioSaavn.Async import JioSaavn +from jiosaavn import Async +from jiosaavn import Sync -jiosaavn = JioSaavn() +asyncJioSaavn = Async.JioSaavn() +syncJioSaavn = Sync.JioSaavn() async def defMain(): - # with print_durations('to call defMain'): - # data = await jiosaavn.song(id='veJXEDAz',)#response='raw') - # data = await jiosaavn.searchSong('alone', ) - # data = await jiosaavn.searchAlbum('Alone',response='raw' ) - data = await jiosaavn.playlist(url='https://www.jiosaavn.com/s/playlist/88063878238ad9a391a33c0e628d2b01/90s_Love/OykxHSA0YytFo9wdEAzFBA__') + # data = await asyncJioSaavn.song(id='veJXEDAz',)) + # data = await asyncJioSaavn.searchSong('alone') + # data = await asyncJioSaavn.searchAlbum('Alone' ) + # data = await asyncJioSaavn.album(id='10496527') + # data = await asyncJioSaavn.playlist(url='https://www.jiosaavn.com/s/playlist/88063878238ad9a391a33c0e628d2b01/90s_Love/OykxHSA0YytFo9wdEAzFBA__') + # data = syncJioSaavn.song(id='veJXEDAz')) + # data = syncJioSaavn.searchSong('alone') + # data = syncJioSaavn.searchAlbum('Alone') + # data = syncJioSaavn.playlist(url='https://www.jiosaavn.com/s/playlist/88063878238ad9a391a33c0e628d2b01/90s_Love/OykxHSA0YytFo9wdEAzFBA__') - print(data) + # print(data) + return '' async def main(): await defMain() - # print(Response) From e034b336dbb9b724e5aff681b58e46678a378ab4 Mon Sep 17 00:00:00 2001 From: vidya sagar Date: Sat, 11 Dec 2021 19:36:29 +0530 Subject: [PATCH 3/3] =?UTF-8?q?=E2=9A=A1=20updated=20to=20v0.0.5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 5 +++-- JioSaavn/__init__.py | 2 +- setup.py | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index c3526c9..4cb8739 100644 --- a/.gitignore +++ b/.gitignore @@ -7,5 +7,6 @@ __pycache__/ .venv/ -dist -JioSaavn.egg-info \ No newline at end of file +dist/ +build/ +jiosaavn.egg-info/ \ No newline at end of file diff --git a/JioSaavn/__init__.py b/JioSaavn/__init__.py index 8593996..63f5704 100644 --- a/JioSaavn/__init__.py +++ b/JioSaavn/__init__.py @@ -1,7 +1,7 @@ from . import Async, Sync from .Sync import JioSaavn,searchSong,searchAlbum,song,album,playlist,lyrics -__version__ = 'v0.0.4' +__version__ = 'v0.0.5' __title__ = "jiosaavn" __description__ = "Search for JioSaavn songs & album. Get song ,album, lyric & playlist information from url or id." diff --git a/setup.py b/setup.py index baf5cdd..d2201bc 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ setup( name = 'jiosaavn', packages = ['jiosaavn'], - version = 'v0.0.4', + version = 'v0.0.5', license='MIT', description = 'Search for JioSaavn songs & album. Get song ,album, lyric & playlist information from url or id.', long_description=long_description,