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)
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'])
Could do this as well
for result in info['results']:
if "trackName" in result:
print(result['trackName'])