接口地址

https://api.vvhan.com/api/rand.music

返回格式

JSON

请求方式:

GET

请求示例(JSON输出)(热歌榜/新歌榜/飙升榜/原创)

https://api.vvhan.com/api/rand.music?type=json&sort=热歌榜


https://api.vvhan.com/api/rand.music?type=json&sort=新歌榜


https://api.vvhan.com/api/rand.music?type=json&sort=飙升榜


https://api.vvhan.com/api/rand.music?type=json&sort=原创


请求示例(MP3输出)(热歌榜/新歌榜/飙升榜/原创)

https://api.vvhan.com/api/rand.music?sort=热歌榜


https://api.vvhan.com/api/rand.music?sort=新歌榜


https://api.vvhan.com/api/rand.music?sort=飙升榜


https://api.vvhan.com/api/rand.music?sort=原创


请求示例(全部输出):

https://api.vvhan.com/api/rand.music?type=all&sort=热歌榜

 

参数说明

名称 必填 类型 说明
sort string 输入歌单名称
type string 输出类型

返回数据

{"sort":"热歌榜","id":1359356908,"name":"晚安","auther":"颜人中","mp3url":"https:\/\/music.163.com\/song\/media\/outer\/url?id=1359356908.mp3","imgurl":"https:\/\/p1.music.126.net\/8N1fsMRm2L5HyZccc6I3ew==\/109951164007377169.jpg"}

调用实例

<video controls="" autoplay="" name="media">
<source src="https://api.vvhan.com/api/rand.music?type=all&sort=热歌榜" type="audio/mpeg">
</video>

示例代码

<?php
header('Content-type:text/json;charset=utf-8;'); date_default_timezone_set("PRC"); $url = "https://api.vvhan.com/api/rand.music"; $type = $_GET['type']; if ($type) { $result = file_get_contents($url . $type); echo $result; } else { header("Location:" . $url); }
?>