DEV Community


Posted on

A Spotify robot

Spotify robot

I want to scrape a Spotify playlist from a web page, at first I try to use selenium, but it is not obtaining the full list, as the song list is dynamically loaded, I must scroll down to the bottom, then it can load all songs.

Finally, I find one Visual Studio Code automation development tool, clicknium (it should be new in 2022), it is really easy to use and one click to locate the UI element.
I just need to record two locators and write several lines of python code, the job is accomplished.

As the list is dynamically loaded, I use an iterate index to search each item, as clicknium can automatically scroll the item into view, it will trigger to load new items, so I don't need to take care of the dynamic loading.

I use a parametric locator for title and author

titleImage description

Image description

As one item may have multiple authors, so I use the following code to get multiple author's names and links:

    element = tab.find_element(, {'index':index})
    authers = element.children
    for item in element.children:
Enter fullscreen mode Exit fullscreen mode

If you want to try Clicknium, you can get started with the video on clicknium official site.

Top comments (0)