日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

android网易云音乐api接口,网易云音乐API分析

發布時間:2023/12/9 编程问答 24 豆豆
生活随笔 收集整理的這篇文章主要介紹了 android网易云音乐api接口,网易云音乐API分析 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

網易云音樂API分析

1. 總覽

本文檔是通過對網易云音樂Android客戶端(1.5.2)的部分功能進行分析得出的

在所有的交互中,均需要在cookie中添加這對鍵值appver=1.5.2;

(Update 2014-07-13) cookie中添加appver=2.0.2 referer設置為http://music.163.com

2. 搜索

POST http://music.163.com/api/search/get/

參數

s: 搜索詞

limit: 返回數量

sub: 意義不明(非必須參數);取值:false

type: 搜索類型;取值意義

1 單曲

10 專輯

100 歌手

1000 歌單

1002 用戶

offset: 偏移數量,用于分頁

MUSIC_U: 意義不明(非必須參數)

示例

curl -d "s=玫瑰色的你&limit=20&type=1&offset=0" -b "appver=1.5.2;" http://music.163.com/api/search/get/

結果:

{

"code": 200,

"result": {

"songCount": 1,

"songs": [

{

"album": {

"status": 1,

"copyrightId": 0,

"name": "\u795e\u7684\u6e38\u620f",

"artist": {

"alias": [],

"picUrl": null,

"id": 0,

"name": ""

},

"publishTime": 1344528000000,

"id": 32311,

"size": 10

},

"status": 1,

"copyrightId": 0,

"name": "\u73ab\u7470\u8272\u7684\u4f60",

"mvid": 5102,

"alias": [],

"artists": [

{

"alias": [],

"picUrl": null,

"id": 10557,

"name": "\u5f20\u60ac"

}

],

"duration": 297927,

"id": 326695

}

]

}

}

3. 獲取歌手專輯列表

GET http://music.163.com/api/artist/albums/[artist_id]/

其中artist_id用歌手id替換

參數

offset: 偏移數量,用于分頁

limit: 返回數量

示例

curl -b "appver=1.5.2;" "http://music.163.com/api/artist/albums/10557?offset=0&limit=3"

結果:

{

"hotAlbums": [

{

"status": 1,

"blurPicUrl": "http://p2.music.126.net/mic-HzsY8tNY6DD1eHzdlg==/612427976714915.jpg",

"commentThreadId": "R_AL_3_2263047",

"description": "",

"tags": "",

"briefDesc": "",

"artist": {

"img1v1Url": "http://p1.music.126.net/6y-UleORITEDbvrOLV0Q8A==/5639395138885805.jpg",

"name": "\u5f20\u60ac",

"briefDesc": "",

"albumSize": 8,

"img1v1Id": 0,

"alias": [

"\u7126\u5b89\u6ea5"

],

"picId": 168225279065170,

"picUrl": "http://p1.music.126.net/F7i_-eBbuhpBXodY5U2oTw==/168225279065170.jpg",

"id": 10557

},

"companyId": 0,

"publishTime": 1349366400007,

"name": "\u795e\u7684\u6e38\u620f \u5de1\u6f14\u7cbe\u534e\u5b9e\u5f55",

"alias": [],

"picId": 612427976714915,

"copyrightId": 0,

"picUrl": "http://p1.music.126.net/mic-HzsY8tNY6DD1eHzdlg==/612427976714915.jpg",

"company": "\u7d22\u5c3c\u97f3\u4e50",

"songs": null,

"type": null,

"id": 2263047,

"size": 7

},

...

],

"more": true,

"code": 200,

"artist": {

"img1v1Url": "http://p1.music.126.net/6y-UleORITEDbvrOLV0Q8A==/5639395138885805.jpg",

"name": "\u5f20\u60ac",

"briefDesc": "",

"albumSize": 8,

"img1v1Id": 0,

"alias": [

"\u7126\u5b89\u6ea5"

],

"picId": 168225279065170,

"picUrl": "http://p1.music.126.net/F7i_-eBbuhpBXodY5U2oTw==/168225279065170.jpg",

"id": 10557

}

}

4. 獲取專輯音樂列表

GET http://music.163.com/api/album/[album_id]/

其中album_id用專輯id替換

示例

curl -b "appver=1.5.2;" "http://music.163.com/api/album/32311/"

結果:

{

"album": {

"alias": [

"Games We Play"

],

"artist": {

"albumSize": 8,

"alias": [

"\u7126\u5b89\u6ea5"

],

"briefDesc": "",

"id": 10557,

"img1v1Id": 0,

"img1v1Url": "http://p1.music.126.net/6y-UleORITEDbvrOLV0Q8A==/5639395138885805.jpg",

"name": "\u5f20\u60ac",

"picId": 168225279065170,

"picUrl": "http://p1.music.126.net/F7i_-eBbuhpBXodY5U2oTw==/168225279065170.jpg"

},

"blurPicUrl": "http://p1.music.126.net/cdoUJ2yO5LRuJhGeIsRdjQ==/46179488380332.jpg",

"briefDesc": "",

"commentThreadId": "R_AL_3_32311",

"company": "\u7d22\u5c3c\u97f3\u4e50\u5a31\u4e50",

"companyId": 0,

"copyrightId": 0,

"description": "2012...\n\n",

"id": 32311,

"info": {

"commentCount": 1,

"comments": null,

"latestLikedUsers": null,

"liked": false,

"likedCount": 0,

"shareCount": 2,

"threadId": "R_AL_3_32311"

},

"name": "\u795e\u7684\u6e38\u620f",

"picId": 46179488380332,

"picUrl": "http://p1.music.126.net/cdoUJ2yO5LRuJhGeIsRdjQ==/46179488380332.jpg",

"publishTime": 1344528000000,

"size": 10,

"songs": [

{

"album": {

"alias": [

"Games We Play"

],

"artist": {

"albumSize": 0,

"alias": [],

"briefDesc": "",

"id": 0,

"img1v1Id": 0,

"img1v1Url": "http://p1.music.126.net/6y-UleORITEDbvrOLV0Q8A==/5639395138885805.jpg",

"name": "",

"picId": 0,

"picUrl": ""

},

"blurPicUrl": "http://p1.music.126.net/cdoUJ2yO5LRuJhGeIsRdjQ==/46179488380332.jpg",

"briefDesc": "",

"commentThreadId": "R_AL_3_32311",

"company": "\u7d22\u5c3c\u97f3\u4e50\u5a31\u4e50",

"companyId": 0,

"copyrightId": 0,

"description": "",

"id": 32311,

"name": "\u795e\u7684\u6e38\u620f",

"picId": 46179488380332,

"picUrl": "http://p1.music.126.net/cdoUJ2yO5LRuJhGeIsRdjQ==/46179488380332.jpg",

"publishTime": 1344528000000,

"size": 10,

"songs": null,

"status": 1,

"tags": "",

"type": ""

},

"alias": [],

"artists": [

{

"albumSize": 0,

"alias": [],

"briefDesc": "",

"id": 10557,

"img1v1Id": 0,

"img1v1Url": "http://p1.music.126.net/6y-UleORITEDbvrOLV0Q8A==/5639395138885805.jpg",

"name": "\u5f20\u60ac",

"picId": 0,

"picUrl": ""

}

],

"bMusic": {

"bitrate": 320000,

"dfsId": 1012650209189891,

"id": 10334056,

"name": "\u73ab\u7470\u8272\u7684\u4f60",

"playTime": 297927,

"size": 11930240

},

"commentThreadId": "R_SO_4_326695",

"copyrightId": 0,

"dayPlays": 0,

"duration": 297927,

"hMusic": {

"bitrate": 320000,

"dfsId": 1012650209189888,

"id": 10334053,

"name": "\u73ab\u7470\u8272\u7684\u4f60",

"playTime": 297927,

"size": 11930240

},

"hearTime": 0,

"id": 326695,

"lMusic": {

"bitrate": 96000,

"dfsId": 1012650209189890,

"id": 10334055,

"name": "\u73ab\u7470\u8272\u7684\u4f60",

"playTime": 297927,

"size": 3595194

},

"mMusic": {

"bitrate": 160000,

"dfsId": 1012650209189889,

"id": 10334054,

"name": "\u73ab\u7470\u8272\u7684\u4f60",

"playTime": 297927,

"size": 5976935

},

"mp3Url": "http://m1.music.126.net/uCNvR9xHLoQIj1kIRyzadQ==/1012650209189889.mp3",

"mvid": 5102,

"name": "\u73ab\u7470\u8272\u7684\u4f60",

"playedNum": 0,

"popularity": 95.0,

"position": 1,

"score": 95,

"starred": false,

"starredNum": 0,

"status": 1

},

...

],

"status": 1,

"tags": "",

"type": ""

},

"code": 200

}

5. 下載音樂文件

GET http://m1.music.126.net/[encrypted_song_id]/[song_dfsId].mp3

其中song_dfsId為歌曲id,同一歌曲不同比特率有不同的id,見上結果。encrypted_song_id為song_dfsId加密后的字符串。

歌曲id加密代碼

import md5

def encrypted_id(id):

byte1 = bytearray('3go8&$8*3*3h0k(2)2')

byte2 = bytearray(id)

byte1_len = len(byte1)

for i in xrange(len(byte2)):

byte2[i] = byte2[i]^byte1[i%byte1_len]

m = md5.new()

m.update(byte2)

result = m.digest().encode('base64')[:-1]

result = result.replace('/', '_')

result = result.replace('+', '-')

return result

總結

以上是生活随笔為你收集整理的android网易云音乐api接口,网易云音乐API分析的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。