'Why do I only get 53 tracks from a Spotify playlist instead of 100 tracks? (using selenium)
I'm a python beginner trying to use Selenium to retrieve all the songs in a Spotify playlist. All of sudden my code stops working after the 53rd song, although there are 100 songs. I have tried x-paths and css selectors. I can't see a change in the class of the song or anything like that. My code:
URL = "https://open.spotify.com/playlist/3kx1rGFZk6QOhgKYqyRNUJ"
driver = webdriver.Chrome(executable_path=chrome_driver_path)
driver.get(url=URL)
time.sleep(5)
data = driver.find_elements(by=By.CSS_SELECTOR, value=".iCQtmPqY0QvkumAOuCjr div")
for song in data:
print(song.get_attribute("innerHTML"))
Could it be that the find_elements method has a limit?
I appreciate your responses, john
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
