I am trying to get the weekly top songs per city - Barcelona to be precise. However, I couldn't find any Spotify API method to obtain this data, so I am thinking of scrapping its web service.
It is my first time doing web scraping and, although I have read a couple of tutorials, I am not able to create a Python that does the following:
For each week, retrieve the song rank, title, and artist of the songs I got when accessing to [I am trying to get the weekly top songs per city - Barcelona to be precise. However, I couldn't find any Spotify API method to obtain this data, so I am thinking of scrapping its web service.
It is my first time doing web scraping and, although I have read a couple of tutorials, I am not able to create a Python that does the following:
For each week, retrieve the song rank, title, and artist of the songs I got when accessing to URL for 2024-02-29 chart where "2024-02-29" will be dynamically changed to explore the different weeks.
So, the resulting dataset I am interested to have will be similar to:
Week Rank Title Artist 2024-02-29 1 FARDOS JC Reyes, De La Ghetto 2024-02-29 2 Manos Rotas DELLAFUENTE, Morad 2024-02-22 1 Manos Rotas DELLAFUENTE, Morad 2024-02-22 2 LA FALDA Myke Towers


This is the basic code I have for the moment. But, when printing the response I am not able to see the song information:
import requests import pandas as pd url = 'https://charts.spotify.com/charts/view/ ... 2024-02-29' response = requests.get(url) print(response.text) Response:
[*]Spotify Charts - Spotify Charts are made by fans2024 Spotify AB
Источник: https://stackoverflow.com/questions/781 ... chart-data