使用Clicknium从Spotify中抓取列表
我需要从Spotify上抓取列表,例如:
"https://open.spotify.com/playlist/6iwz7yurUKaILuykiyeztu
由于列表是动态加载的,我使用迭代索引来搜索每个项目,因为[Clicknium](https://www.clicknium.com)可以自动滚动到项目,它会触发加载新的项目。
我使用参数定位器来表示标题和作者
因为一个itme可能有多个作者,所以我使用以下代码来获取多个作者的姓名和链接:
选择 | 换行 | 行号
- element = tab.find_element(locator.chrome.open.div_auther, {'index':index})
- authers = element.children
- for item in element.children:
- artist.append(item.get_text())
- link.append(item.get_property('href'))
有关完整的示例代码,请参阅 Github