r/PythonLearning • u/Austinwhitely • 7h ago
Help Request Need Help With My Selenium Spotify Playlist Scraper
Hello, I am attempting to make a spotify playlist scraper. The html reading and everything else is working correctly but the automatic scrolling is not fully working yet and I am stuck. For some reason when i get to about the 100 song mark, Spotify refuses to load any more songs for me. I have tried waiting it out, scrolling a bit more to hopefully trigger it to load, and adding some fake clicks to try to trigger spotify to load. I dont know why it is doing this because when I manually use page down to scroll on a seperate browser it works perfectly. Here is a video of what is happening, and I have linked my github repo for you guys to take a look at it because I cannot post both a video and an image.
1
u/mountain-snowman 1h ago
There are many ways through many events to detect the point when Spotify needs to load more songs. You have to figure out what event triggers the load function and use selenium to trigger that event.
If you are developing not a tool but rather a script that you are planning to use only a couple of times, you can use the devtools for scraping. Scroll manually to load songs and then manually call the script to scrape. Finally, get all your data in json.