Last answered:

22 Nov 2022

Posted on:

27 Sept 2022

0

the api was updated ,now it contains Audiobooks with no "trackName"

Maybe use result.get('trackName', 'NO NAME AVAILABLE) to print all songs names

2 answers ( 0 marked as helpful)
Posted on:

03 Nov 2022

1

info=requests.get(site_url,params={'term':'the beatles','country':'us','limit':200})
i=info.json()
for k in range(200):
    print(str(k) + "\n " +i['results'][k]['artistName'] + " : " + i['results'][k]['releaseDate'])

Posted on:

22 Nov 2022

2

Could do this as well
for result in info['results']:
    if "trackName" in result:
        print(result['trackName'])

Submit an answer