各大音乐平台的api汇总

网易云音乐

歌曲搜索

格式

请求方式 : POST

请求地址 :

1
https://music.163.com/api/search/get/web?csrf_token=hlpretag=&hlposttag=&s=歌名&type=1&offset=0&total=true&limit=1

示例

1
https://music.163.com/api/search/get/web?csrf_token=hlpretag=&hlposttag=&s=阳光正好-十二越&type=1&offset=0&total=true&limit=1

效果

请求结果如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
{
"result": {
"songs": [
{
"id": 1335942808,
"name": "阳光正好",
"artists": [
{
"id": 31021271,
"name": "十二越",
"picUrl": null,
"alias": [],
"albumSize": 0,
"picId": 0,
"fansGroup": null,
"img1v1Url": "https://p2.music.126.net/6y-UleORITEDbvrOLV0Q8A==/5639395138885805.jpg",
"img1v1": 0,
"trans": null
}
],
"album": {
"id": 74994476,
"name": "阳光正好",
"artist": {
"id": 0,
"name": "",
"picUrl": null,
"alias": [],
"albumSize": 0,
"picId": 0,
"fansGroup": null,
"img1v1Url": "https://p1.music.126.net/6y-UleORITEDbvrOLV0Q8A==/5639395138885805.jpg",
"img1v1": 0,
"trans": null
},
"publishTime": 1545753600000,
"size": 1,
"copyrightId": 558010,
"status": 0,
"picId": 109951163752920822,
"mark": 0
},
"duration": 304111,
"copyrightId": 558010,
"status": 0,
"alias": [],
"rtype": 0,
"ftype": 0,
"mvid": 0,
"fee": 8,
"rUrl": null,
"mark": 8192
}
],
"songCount": 1
},
"code": 200
}

获取歌曲播放直链地址

格式

请求方式 :GET

请求地址 :

1
https://music.163.com/song/media/outer/url?id=歌曲ID.mp3

示例

歌曲ID我们可以通过浏览器地址获取 比如 http://music.163.com/#/m/song?id=1901359372

那么该首歌的直链地址为:

1
https://music.163.com/song/media/outer/url?id=1901359372.mp3

我们可以将该地址其嵌入到 HTML中 使用audio标签:

1
<audio controls="controls" title="歌名" src="直链地址"></audio>

效果

注意: 这种方式只能获取到免费歌曲的直链 如果是VIP收费歌曲 则获取不到

获取歌曲歌词

格式

请求方式 : GET

请求地址:

1
http://music.163.com/api/song/lyric?os=pc&id=歌曲ID&lv=-1&kv=-1&tv=-1

请求参数含义:

  • &tv=-1 : 表示获取歌词译文
  • &lv=-1 : 表示获取歌词原文
  • &kv=-1 : 表示获取歌词状态信息

示例

1
http://music.163.com/api/song/lyric?os=pc&id=1901359372&lv=-1&kv=-1&tv=-1

效果

请求结果如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
{
"sgc": false,
"sfy": false,
"qfy": false,
"lrc": {
"version": 3,
"lyric": "[00:00.00] 作词 : 十二越\n[00:01.00] 作曲 : 十二越\n[00:02.00] 编曲 : 十二越\n[00:16.28]\n[00:31.53] 你在哪里\n[00:37.87] 回忆闪烁不停\n[00:45.05] 我在这里\n[00:50.81] 一直等你\n[00:53.24] 在原地\n[00:57.71]\n[00:58.54] 时间一点一点过去\n[01:03.65] 真假不明\n[01:07.00] 沉醉在我们记忆\n[01:11.04]\n[01:12.05] 世界开始变得忧郁\n[01:17.14] 昏暗不明\n[01:20.49] 只为了你\n[01:25.39]\n[01:25.62] 你说 你说你还爱我\n[01:30.63] 是唯一的承诺\n[01:33.92] 却只剩承诺 没有了结果\n[01:36.43]\n[01:38.86] 你说 你说你会等我\n[01:44.12] 是绝对的承诺\n[01:47.55] 却没了联络 只剩下沉默\n[01:49.28]\n[01:50.62]\n[01:52.65] 你在哪里\n[01:59.01] 回忆闪烁不停\n[02:06.15] 我在这里\n[02:11.62] 一直等你\n[02:14.56] 在原地\n[02:18.24]\n[02:19.68] 时间一点一点过去\n[02:24.75] 真假不明\n[02:28.15] 沉醉在我们记忆\n[02:29.63]\n[02:33.14] 世界开始变得忧郁\n[02:38.23] 昏暗不明\n[02:41.61] 只为了你\n[02:43.30]\n[02:46.70] 你说 你说你还爱我\n[02:51.73] 是唯一的承诺\n[02:55.12] 却只剩承诺 没有了结果\n[02:59.38]\n[03:00.18] 你说 你说你会等我\n[03:05.32] 是绝对的承诺\n[03:08.69] 却没了联络 只剩下沉默\n[03:10.41]\n[03:13.82] 你说 你说你还爱我\n[03:19.69] 最后的承诺变成了软弱\n[03:25.19] 你说 你说 你说....\n[03:28.86]\n[03:40.89] 你说 你说你还爱我\n[03:45.89] 是唯一的承诺\n[03:49.26] 却只剩承诺 没有了结果\n[03:51.51]\n[03:54.36] 你说 你说你还爱我\n[04:00.33] 最后的承诺变成了软弱\n[04:10.02] 你说\n[04:12.56]\n[04:29.25] 混音 : 十二越\n"
},
"klyric": {
"version": 0,
"lyric": ""
},
"tlyric": {
"version": 0,
"lyric": ""
},
"code": 200
}

获取歌曲的详细信息

格式

请求方法: GET

请求地址 :

1
http://music.163.com/api/song/detail/?id=歌曲id&ids=[歌曲id]

示例

1
http://music.163.com/api/song/detail/?id=1901359372&ids=[1901359372]

效果

请求结果如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
{
"songs": [
{
"name": "你说你还爱我",
"id": 1901359372,
"position": 0,
"alias": [],
"status": 0,
"fee": 8,
"copyrightId": 2708773,
"disc": "01",
"no": 4,
"artists": [
{
"name": "十二越",
"id": 31021271,
"picId": 0,
"img1v1Id": 0,
"briefDesc": "",
"picUrl": "http://p2.music.126.net/6y-UleORITEDbvrOLV0Q8A==/5639395138885805.jpg",
"img1v1Url": "http://p2.music.126.net/6y-UleORITEDbvrOLV0Q8A==/5639395138885805.jpg",
"albumSize": 0,
"alias": [],
"trans": "",
"musicSize": 0,
"topicPerson": 0
}
],
"album": {
"name": "茶余饭后",
"id": 137142351,
"type": "EP",
"size": 5,
"picId": 109951166702919266,
"blurPicUrl": "http://p2.music.126.net/3474m94J-3GI3LIfdRTBmA==/109951166702919266.jpg",
"companyId": 0,
"pic": 109951166702919266,
"picUrl": "http://p2.music.126.net/3474m94J-3GI3LIfdRTBmA==/109951166702919266.jpg",
"publishTime": 1638892800000,
"description": "",
"tags": "",
"company": "HIFIVE智能经纪人",
"briefDesc": "",
"artist": {
"name": "",
"id": 0,
"picId": 0,
"img1v1Id": 0,
"briefDesc": "",
"picUrl": "http://p2.music.126.net/6y-UleORITEDbvrOLV0Q8A==/5639395138885805.jpg",
"img1v1Url": "http://p2.music.126.net/6y-UleORITEDbvrOLV0Q8A==/5639395138885805.jpg",
"albumSize": 0,
"alias": [],
"trans": "",
"musicSize": 0,
"topicPerson": 0
},
"songs": [],
"alias": [],
"status": 0,
"copyrightId": 2708773,
"commentThreadId": "R_AL_3_137142351",
"artists": [
{
"name": "十二越",
"id": 31021271,
"picId": 0,
"img1v1Id": 0,
"briefDesc": "",
"picUrl": "http://p2.music.126.net/6y-UleORITEDbvrOLV0Q8A==/5639395138885805.jpg",
"img1v1Url": "http://p2.music.126.net/6y-UleORITEDbvrOLV0Q8A==/5639395138885805.jpg",
"albumSize": 0,
"alias": [],
"trans": "",
"musicSize": 0,
"topicPerson": 0
}
],
"subType": "录音室版",
"transName": null,
"onSale": false,
"mark": 0,
"gapless": 0,
"dolbyMark": 0,
"picId_str": "109951166702919266"
},
"starred": false,
"popularity": 5,
"score": 5,
"starredNum": 0,
"duration": 269258,
"playedNum": 0,
"dayPlays": 0,
"hearTime": 0,
"sqMusic": {
"name": null,
"id": 6988110024,
"size": 28403471,
"extension": "flac",
"sr": 44100,
"dfsId": 0,
"bitrate": 843901,
"playTime": 269258,
"volumeDelta": -37808
},
"hrMusic": null,
"ringtone": "",
"crbt": null,
"audition": null,
"copyFrom": "",
"commentThreadId": "R_SO_4_1901359372",
"rtUrl": null,
"ftype": 0,
"rtUrls": [],
"copyright": 0,
"transName": null,
"sign": null,
"mark": 0,
"originCoverType": 0,
"originSongSimpleData": null,
"single": 0,
"noCopyrightRcmd": null,
"hMusic": {
"name": null,
"id": 6988110025,
"size": 10772942,
"extension": "mp3",
"sr": 44100,
"dfsId": 0,
"bitrate": 320000,
"playTime": 269258,
"volumeDelta": -37825
},
"mMusic": {
"name": null,
"id": 6988110027,
"size": 6463782,
"extension": "mp3",
"sr": 44100,
"dfsId": 0,
"bitrate": 192000,
"playTime": 269258,
"volumeDelta": -35358
},
"lMusic": {
"name": null,
"id": 6988110029,
"size": 4309203,
"extension": "mp3",
"sr": 44100,
"dfsId": 0,
"bitrate": 128000,
"playTime": 269258,
"volumeDelta": -33920
},
"bMusic": {
"name": null,
"id": 6988110029,
"size": 4309203,
"extension": "mp3",
"sr": 44100,
"dfsId": 0,
"bitrate": 128000,
"playTime": 269258,
"volumeDelta": -33920
},
"mvid": 0,
"mp3Url": null,
"rtype": 0,
"rurl": null
}
],
"equalizers": {},
"code": 200
}

QQ音乐

本文为作者原创 转载时请注明出处 谢谢

乱码三千 – 点滴积累 ,欢迎来到乱码三千技术博客站

0%