How does the Spotify web browser button interact with the Spotify app?

前端 未结 3 1365
Happy的楠姐
Happy的楠姐 2020-12-15 08:49

Check out this play button, written entirely it seems, using javascript: spotify play button.

Notice that pressing play will cause Spotify to start playing music. OK

3条回答
  •  抹茶落季
    2020-12-15 09:16

    The desktop runs a server at *.spotilocal.com on your computer, then on the web, the embed player (example) will choose a subdomain name (example: fdxubmxkqp.spotilocal.com).

    It then makes request to the local server's API, examples:

    https://fdxubmxkqp.spotilocal.com:4370/service/version.json
    https://fdxubmxkqp.spotilocal.com:4370/simplecsrf/token.json
    

    And it just returns some JSON:

    {
    "version": 9, 
    "client_version": "1.0.10.107.gd0dfca3a"
    }
    

    See this screenshot for more info, or you can get the same info by going to news.spotify.com and using the Network inspector with spotilocal as a filter.

提交回复
热议问题