Seji64 / spoonie

Sync Spotify playlist to a Creative Tonie
MIT License
5 stars 0 forks source link

Failed to parse TRACKS_URL response: 'NoneType' object is not subscriptable #2

Closed heilmoa closed 5 months ago

heilmoa commented 6 months ago

If i add a Podcast like "Anna und die wilden Tiere" or "Checkpod", the get_song_info function fails. It is probably because of the podcast format. The data looks empty and there are no tracks found.

Hope there is a simple solution for this, like using dummy data for the necessary fields.

Example spotify track: https://open.spotify.com/episode/4bK5cKclzHMhPYo4YpNeNp?si=80a31887561d4ac2

2024-04-01 06:15:05,177 | Failed to parse TRACKS_URL response: 'NoneType' object is not subscriptable
{
  "tracks" : [ null ]
}
Traceback (most recent call last):
  File "/app/spoonie.py", line 166, in get_song_info
    for data in info['tracks'][0]['artists']:
                ~~~~~~~~~~~~~~~~~^^^^^^^^^^^
TypeError: 'NoneType' object is not subscriptable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/app/spoonie.py", line 375, in main
    (artists, raw_artists, album_name, name, image_url, release_year, disc_number,track_number, scraped_song_id, is_playable, duration_ms) = get_song_info(spotifySession,track_id)
                                                                                                                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/spoonie.py", line 186, in get_song_info
    raise ValueError(f'Failed to parse TRACKS_URL response: {str(e)}\n{raw}')
ValueError: Failed to parse TRACKS_URL response: 'NoneType' object is not subscriptable
{
  "tracks" : [ null ]
}
Seji64 commented 6 months ago

Podcast seems to follow a different logic. When i have some free time i will try to implement Podcast support.