Malith-Rukshan / Suno-API

SunoAI Unofficial Python API Library and REST API for Suno.ai — Create Music with Generative AI ! ✨
https://pypi.org/project/SunoAI
MIT License
56 stars 15 forks source link

Searching for some songs returns empty list json response #8

Open BenjinZA opened 2 months ago

BenjinZA commented 2 months ago

Some songs seem to return an empty list, resulting in a list index out of range error.

Below code with random song picked from the https://suno.com homepage.

from suno import Suno, ModelVersions

suno_cookie = "<cookie>"

suno_client = Suno(cookie=suno_cookie, model_version=ModelVersions.CHIRP_V3_5)

song = suno_client.get_song('c13604b8-8a1b-4e84-b741-0e9197405a39')

Error traceback:

Traceback (most recent call last):
  File "test.py", line 8, in <module>
    song = suno_client.get_song('c13604b8-8a1b-4e84-b741-0e9197405a39')
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "...\Python\Python311\site-packages\suno\suno.py", line 214, in get_song
    return create_clip_from_data(response.json()[0])
                                 ~~~~~~~~~~~~~~~^^^
IndexError: list index out of range

Doing some further testing with below code shows an empty list is being returned, hence the out of range error.

from suno import Suno, ModelVersions

suno_cookie = "<cookie>"

suno_client = Suno(cookie=suno_cookie, model_version=ModelVersions.CHIRP_V3_5)

response = suno_client.client.get("https://studio-api.suno.ai/api/feed/?ids=c13604b8-8a1b-4e84-b741-0e9197405a39")

print(response.json())

>>>[]