简体   繁体   English

自动化 Spotify 登录使用 Selenium、Python

[英]Automation Spotify Login using Selenium, Python

I have a Voice Assistant.我有一个语音助手。 And I want it to Login to my Spotify Account and play a song.我希望它登录到我的 Spotify 帐户并播放歌曲。 The real problem is there are no IDs for buttons.真正的问题是按钮没有 ID。 So I am having trouble locating buttons and clicking them.所以我无法找到按钮并单击它们。

elif 'spotify' in query:
        def spotify_login():
            DRIVER = webdriver.Chrome(
                executable_path='<EXECUTABLE_PATH>')
            print('Searching for Login Button')
            DRIVER.get('https://open.spotify.com/')
            speak("Opened Spotify.")
            DRIVER.maximize_window()
            login_button = DRIVER.find_element_by_id('<id>')
            login_button.click()
            speak('Clicked On Login')

        spotify_login()

Here is the code.这是代码。

Have you tried automation through a dedicated spotify api such as "tekore" or "Spotipy": https://pypi.org/project/tekore/您是否尝试过通过专用的 spotify api(例如“tekore”或“Spotipy”)实现自动化: https://pypi.org/project/tekore/

https://github.com/plamere/spotipy https://github.com/plamere/spotipy

It might be easier to use either of these apis to interact with the Spotify web app rather than trying to automate the process with selenium.使用这些 api 中的任何一个与 Spotify web 应用程序交互可能更容易,而不是尝试使用 selenium 来自动化该过程。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM