I’m having trouble accessing Spotify’s chart data after their recent changes
Spotify changed how they handle their viral charts system. The old method I was using no longer works since they moved everything to their web player interface.
I need to pull track information from their viral charts programmatically using Python. Specifically, I want to get the song data from the Global Viral 50 playlist.
import requests
# This is what I was trying but it doesn't work anymore
def fetch_chart_data(chart_id):
endpoint = f"https://api.spotify.com/v1/charts/{chart_id}"
headers = {'Authorization': f'Bearer {access_token}'}
response = requests.get(endpoint, headers=headers)
return response.json()
# Target chart ID format: spotify:app:chart:6o9o1UphRtyv10VPuDT80D
viral_chart_id = "6o9o1UphRtyv10VPuDT80D"
result = fetch_chart_data(viral_chart_id)
Has anyone found a working solution to access this data through Spotify’s API or any other method? I’ve been stuck on this for a while and would really appreciate any guidance.
Honestly surprised they killed the charts API without a proper announcement. If you’re pulling viral data regularly, cache the playlist ID - Spotify updates these curated playlist URIs without warning sometimes. Learned that the hard way when my scraper randomly broke lol
yea the chart endpoint’s gone now, but check out spotipy, it’s way easier! just treat the Viral 50 like a normal playlist and use the playlist ID to pull tracks. should do the trick!
Yeah, the charts API got deprecated, but Global Viral 50 still exists as a playlist. Hit the same wall last month scraping chart data for my project. Just use the playlist endpoint instead - you’ll need to grab the actual playlist ID though, since it’s different from the old chart ID format. Then hit playlists/{playlist_id}/tracks with your usual auth setup. Data structure’s a bit different (playlist items vs chart entries), but all the track info’s still there. Been rock solid for me since I switched over.
Had this exact issue a few months back building a chart tracker. The trick is finding the right playlist URI since Spotify moved all their chart data into curated playlists. For Global Viral 50, the playlist ID is 37i9dQZEVXbLiRSasKsNU9 - took me forever to find that through their web interface. Once you’ve got it, standard playlist calls work fine. You get more metadata now compared to the old chart format, including playlist position which is basically your chart ranking. Just make sure your token has playlist access scopes.