I am trying to extract song data from this URL https://open.spotify.com/playlist/37i9dQZEVXbNG2KDcFcKOF and here is my code trials:
import requests
from bs4 import BeautifulSoup
URL = "https://open.spotify.com/playlist/37i9dQZEVXbNG2KDcFcKOF"
page = requests.get(URL)
page_source = BeautifulSoup(page.text, "lxml")
song_tables = page_source.find_all("div", {"data-testid": "tracklist-row"})
data = []
for song_table in song_tables:
s = song_table.find_all("span", attrs={"data-encore-id": "type"})
if s:
data.append([s.text])
print(data)
I am getting an empty list. I am new to webscrap