artyshko / smd

Spotify Music Downloader
MIT License
1.36k stars 238 forks source link

IndexError: list index out of range #56

Open MahbodHastam opened 4 years ago

MahbodHastam commented 4 years ago

image

RedstoneFireBE commented 4 years ago

In order to bypass this error, I have edited the line 160 in spotify.py

'image' : data['album']['images'][0]['url'] if len(data['album']['images']) > 0 else ''

It's seem to work fine

savorocks commented 4 years ago

I have a similar error when trying to download album from spotify, not sure how this causes the error in youtube.py:

python3 main.py -sa "https://open.spotify.com/album/4EYZaRvd05NA1IVzJZv8dd"
Downloading 1 of 12
Traceback (most recent call last):
  File "main.py", line 771, in <module>
    CLI.main(sys.argv[1:])
  File "main.py", line 614, in main
    md.downloadBySpotifyUriAlbumMode(array[i+1], CLI.path)
  File "main.py", line 279, in downloadBySpotifyUriAlbumMode
    self.__downloadMusicFromYoutube(fixed_name, info['uri'], info['duration_ms'])
  File "main.py", line 34, in __downloadMusicFromYoutube
    url=self.__youtube.getResult(),
  File "/home/savo/smd/youtube.py", line 70, in getResult
    return self.__result[i]
IndexError: list index out of range
genialkartik commented 4 years ago

Tried the hack by @RedstoneFireBE , but still getting the same error. Does anyone know any other trick?

isaiahfuller commented 4 years ago

I have a similar error when trying to download album from spotify, not sure how this causes the error in youtube.py:

python3 main.py -sa "https://open.spotify.com/album/4EYZaRvd05NA1IVzJZv8dd"
Downloading 1 of 12
Traceback (most recent call last):
  File "main.py", line 771, in <module>
    CLI.main(sys.argv[1:])
  File "main.py", line 614, in main
    md.downloadBySpotifyUriAlbumMode(array[i+1], CLI.path)
  File "main.py", line 279, in downloadBySpotifyUriAlbumMode
    self.__downloadMusicFromYoutube(fixed_name, info['uri'], info['duration_ms'])
  File "main.py", line 34, in __downloadMusicFromYoutube
    url=self.__youtube.getResult(),
  File "/home/savo/smd/youtube.py", line 70, in getResult
    return self.__result[i]
IndexError: list index out of range

Spotify is only used to find song/playlist info lol. Same with everything else I think. It downloads from YT.

Tried the hack by @RedstoneFireBE , but still getting the same error. Does anyone know any other trick?

The way it searches is dead, I think. Search results are loaded through JS now. Looks like just using the API (or the unofficial YTMusic one) would work, especially for just getting a URL.