【问题标题】:Getting data from Spotify app (Windows/Mac)从 Spotify 应用程序获取数据 (Windows/Mac)
【发布时间】:2018-02-18 22:36:47
【问题描述】:

如何从应用程序 (Windows/Mac) 获取音乐播放、倾斜、艺术家等数据。有一个使用 Web API 的选项,但我测试了 Musixmatch 应用程序,即使我处于离线状态,它也能正常工作,因此可以以某种方式连接到应用程序。

【问题讨论】:

    标签: spotify spotify-app


    【解决方案1】:

    PySpotify!看起来它支持任何支持 Python 的操作系统(包括 Windows 和 Mac)。

    【讨论】:

    • 此实现基于我在回答中提到的“不再受支持”库
    【解决方案2】:

    您喜欢在哪里以及如何使用这些数据?您可以查看 Windows 中的 %AppData% 文件夹。除此之外,您可以使用 UFT/QTP 或 Sikuli 等自动化工具,您可以使用这些工具从 Spotify 用户界面获取数据。但是 WebAPI 是最好的方法

    【讨论】:

    • 我想从旧版本的 Spotify 中重新制作“歌词”功能。 Musixmatch 做同样的事情,但我想在背景上添加艺术家的大图以使其看起来更好。
    【解决方案3】:

    Spotify 公开了一些可用于查询应用程序状态的 API

    例如,如果您使用的是 Apple 系统,您可以使用 AppleScript API:

    -- Creates a notification with information about the currently playing track
    
    -- Main flow
    set currentlyPlayingTrack to getCurrentlyPlayingTrack()
    displayTrackName(currentlyPlayingTrack)
    
    -- Method to get the currently playing track
    on getCurrentlyPlayingTrack()
      tell application "Spotify"
        set currentArtist to artist of current track as string
        set currentTrack to name of current track as string
      
        return currentArtist & " - " & currentTrack
      end tell
    end getCurrentlyPlayingTrack
    
    -- Method to create a notification
    on displayTrackName(trackName)
      display notification "Currently playing " & trackName
    
      -- A delay is set added make sure the notification is shown long enough before the script ends
      delay 1
    
    end displayTrackName
    

    这个例子来自官方文档,你可以找到here

    改用 Windows 我想说目前还没有明确的方法可以做到这一点。曾经有Libspotify SDK 但不再支持。

    似乎这个库将被一些新的 Windows/Mac/其他 API 替代,但目前只有手机操作系统的 beta 版本,我真的找不到任何适用于 Windows 的东西。

    所以看来你唯一的选择是使用这个库的旧版本并希望它仍然可以正常工作。

    【讨论】:

      【解决方案4】:

      Spotify 通过“c:\users\username\appdata\local\spotify\data”文件夹进行缓存。这里可能有一些东西可以帮助你。

      【讨论】:

        猜你喜欢
        • 2012-01-14
        • 2016-06-26
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-01-18
        • 1970-01-01
        • 2019-04-14
        相关资源
        最近更新 更多