{ "code": 200, "msg": "success", "data": { "songs": [{ "id": 458231315, "name": "我愛你", "artists": [{ "id": 1193188, "name": "Ayasa绚沙", "picUrl": null, "alias": [], "albumSize": 0, "picId": 0, "img1v1Url": "https://p2.music.126.net/6y-UleORITEDbvrOLV0Q8A==/5639395138885805.jpg", "img1v1": 0, "trans": null }], "album": { "id": 35157350, "name": "BEST I", "artist": { "id": 0, "name": "", "picUrl": null, "alias": [], "albumSize": 0, "picId": 0, "img1v1Url": "https://p2.music.126.net/6y-UleORITEDbvrOLV0Q8A==/5639395138885805.jpg", "img1v1": 0, "trans": null }, "publishTime": 1485273600000, "size": 16, "copyrightId": -1, "status": 0, "picId": 109951163984548450, "mark": 0 }, "duration": 230826, "copyrightId": 739012, "status": 0, "alias": [], "rtype": 0, "ftype": 0, "mvid": 0, "fee": 1, "rUrl": null, "mark": 139264 }], "songCount": 600 }, "Author": { "name": "Alone88", "desc": "由Alone88提供的免费API 服务,官方文档:www.alapi.cn" } }
<?php /** * Created by PhpStorm. * User: FZS * Time: 2020/02/01 00:16 */ class freeApi { private $apiUrl; public function __construct() { $this->apiUrl = 'https://v1.alapi.cn/api/music/search?keyword=我爱你'; } /** * 获取结果 * @return array */ public function getResult() { return file_get_contents($this->apiUrl); } }
package main import ( "fmt" "io/ioutil" "log" "net/http" ) const ( APIURL = "https://v1.alapi.cn/api/music/search" ) func main() { queryUrl := fmt.Sprintf("%s?keyword=我爱你",APIURL) resp, err := http.Get(queryUrl) if err != nil { log.Println(err) return } defer resp.Body.Close() body, err := ioutil.ReadAll(resp.Body) if err != nil { fmt.Println(err) return } fmt.Println(string(body)) }