How can I get number of followers with Spotify API?(我如何通过Spotify API获得粉丝数量?)
问题描述
我正在尝试获取某个艺术家的关注者数量。
如果我使用元数据API调用
http://ws.spotify.com/lookup/1/?uri=spotify:artist:4YrKBkKSVeqDamzBPWVnSJ
我只知道艺术家的名字。
我假设您需要推荐答案解决方案。
使用spotify-web-api-php库(无耻的自我推销)真的很容易。看看这个例子:
<?php
require_once 'src/Request.php';
require_once 'src/SpotifyWebAPI.php';
$api = new SpotifyWebAPISpotifyWebAPI();
$artist = $api->getArtist('0OdUWJ0sBjDrqHygGUXeCF');
echo '<b>Number of followers:</b> ' . $artist->followers->total;
如前所述,还可以查看official Spotify docs。
这篇关于我如何通过Spotify API获得粉丝数量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!