百度音樂 API

Summerm發表於2020-01-02

用fiddler來對百度音樂安卓客戶端抓包

百度音樂分類:

1、新歌榜,2、熱歌榜,
11、搖滾榜,12、爵士,16、流行
21、歐美金曲榜,22、經典老歌榜,23、情歌對唱榜,24、影視金曲榜,25、網路歌曲榜

說明:
百度music web版全介面
http://tingapi.ting.baidu.com/v1/restserve...

獲取方式:GET
引數:
format: json|xml
callback:
from: webapp_music
method:

//獲取列表
baidu.ting.billboard.billList {type:1,size:10, offset:0}
type: //1、新歌榜,2、熱歌榜,
11、搖滾榜,12、爵士,16、流行
21、歐美金曲榜,22、經典老歌榜,23、情歌對唱榜,24、影視金曲榜,25、網路歌曲榜
size: 10 //返回條目數量
offset: 0 //獲取偏移

//貌似是推廣,無用
baidu.ting.adv.showlist { : (new Date)}
: //時間戳

//搜尋
baidu.ting.search.catalogSug { query: keyword }
query: ‘’ //搜尋關鍵字

//播放
baidu.ting.song.play {songid: id}
baidu.ting.song.playAAC {songid: id}

//LRC歌詞
baidu.ting.song.lry {songid: id}

//推薦列表
baidu.ting.song.getRecommandSongList {song_id: id, num: 5 }
num: //返回條目數量

//下載
baidu.ting.song.downWeb {songid: id, bit:“24, 64, 128, 192, 256, 320, flac”, _t: (new Date())}
songid: //歌曲id
bit: //位元速率
_t: //時間戳

//獲取歌手資訊
baidu.ting.artist.getInfo { tinguid: id }
tinguid: //歌手ting id

//獲取歌手歌曲列表
baidu.ting.artist.getSongList { tinguid: id, limits:6, use_cluster:1, order:2}
tinguid: //歌手ting id
limits: //返回條目數量

json資料格式參考如下:
1.
獲取榜單專輯:
http://tingapi.ting.baidu.com/v1/restserve...

[
    {
    "artist_id": "88",
    "language": "\u56fd\u8bed",
    "pic_big": "http:\/\/musicdata.baidu.com\/data2\/pic\/8ed6c0b266f41eacdf69c9018c52ec1e\/241838023\/241838023.jpg",
    "pic_small": "http:\/\/musicdata.baidu.com\/data2\/pic\/cf635d76f825044a19656e990dda77d5\/241838026\/241838026.jpg",
    "country": "\u5185\u5730",
    "area": "0",
    "publishtime": "2015-05-20",
    "album_no": "1",
    "lrclink": "http:\/\/musicdata.baidu.com\/data2\/lrc\/ac66a881bd5cb97ad351936606c37495\/266097259\/266097259.lrc",
    "copy_type": "1",
    "hot": "1471582",
    "all_artist_ting_uid": "2517",
    "resource_type": "0",
    "is_new": "0",
    "rank_change": "0",
    "rank": "1",
    "all_artist_id": "88",
    "style": "\u6d41\u884c",
    "del_status": "0",
    "relate_status": "0",
    "toneid": "0",
    "all_rate": "64,128,192,256,320,flac",
    "sound_effect": "0",
    "file_duration": 0,
    "has_mv_mobile": 0,
    "versions": "",
    "bitrate_fee": "{\"0\":\"0|0\",\"1\":\"0|0\"}",
    "song_id": "242078437",
    "title": "\u6f14\u5458",
    "ting_uid": "2517",
    "author": "\u859b\u4e4b\u8c26",
    "album_id": "241838068",
    "album_title": "\u7ec5\u58eb",
    "is_first_publish": 0,
    "havehigh": 2,
    "charge": 0,
    "has_mv": 0,
    "learn": 0,
    "song_source": "web",
    "piao_id": "0",
    "korean_bb_song": "0",
    "resource_type_ext": "0",
    "mv_provider": "0000000000",
    "artist_name": "\u859b\u4e4b\u8c26"
    },
    {
    "artist_id": "88",
    "language": "\u56fd\u8bed",
    "pic_big": "http:\/\/musicdata.baidu.com\/data2\/pic\/14c544e32bef326d54e0de16f0e3858f\/266259604\/266259604.jpg",
    "pic_small": "http:\/\/musicdata.baidu.com\/data2\/pic\/e3ed2790a7eba2e7f7b0e85880a0e99e\/266259607\/266259607.jpg",
    "country": "\u5185\u5730",
    "area": "0",
    "publishtime": "2016-06-07",
    "album_no": "1",
    "lrclink": "http:\/\/musicdata.baidu.com\/data2\/lrc\/a4014c4e7937cc48cc79bf77d42a4e0e\/266259963\/266259963.lrc",
    "copy_type": "1",
    "hot": "940241",
    "all_artist_ting_uid": "2517",
    "resource_type": "0",
    "is_new": "0",
    "rank_change": "0",
    "rank": "2",
    "all_artist_id": "88",
    "style": "\u6d41\u884c",
    "del_status": "0",
    "relate_status": "0",
    "toneid": "0",
    "all_rate": "64,128,256,320,flac",
    "sound_effect": "0",
    "file_duration": 0,
    "has_mv_mobile": 0,
    "versions": "",
    "bitrate_fee": "{\"0\":\"0|0\",\"1\":\"0|0\"}",
    "song_id": "266259728",
    "title": "\u521a\u521a\u597d",
    "ting_uid": "2517",
    "author": "\u859b\u4e4b\u8c26",
    "album_id": "266259670",
    "album_title": "\u521a\u521a\u597d",
    "is_first_publish": 0,
    "havehigh": 2,
    "charge": 0,
    "has_mv": 1,
    "learn": 0,
    "song_source": "web",
    "piao_id": "0",
    "korean_bb_song": "0",
    "resource_type_ext": "0",
    "mv_provider": "1000000000",
    "artist_name": "\u859b\u4e4b\u8c26"
    }
],
    "billboard": {
    "billboard_type": "2",
    "billboard_no": "1895",
    "update_date": "2016-07-13",
    "billboard_songnum": "588",
    "havemore": 1,
    "name": "\u70ed\u6b4c\u699c",
    "comment": "\u8be5\u699c\u5355\u662f\u6839\u636e\u767e\u5ea6\u97f3\u4e50\u5e73\u53f0\u6b4c\u66f2\u6bcf\u5468\u64ad\u653e\u91cf\u81ea\u52a8\u751f\u6210\u7684\u6570\u636e\u699c\u5355\uff0c\u7edf\u8ba1\u8303\u56f4\u4e3a\u767e\u5ea6\u97f3\u4e50\u5e73\u53f0\u4e0a\u7684\u5168\u90e8\u6b4c\u66f2\uff0c\u6bcf\u65e5\u66f4\u65b0\u4e00\u6b21",
    "pic_s640": "http:\/\/b.hiphotos.baidu.com\/ting\/pic\/item\/5d6034a85edf8db1194683910b23dd54574e74df.jpg",
    "pic_s444": "http:\/\/d.hiphotos.baidu.com\/ting\/pic\/item\/c83d70cf3bc79f3d98ca8e36b8a1cd11728b2988.jpg",
    "pic_s260": "http:\/\/a.hiphotos.baidu.com\/ting\/pic\/item\/838ba61ea8d3fd1f1326c83c324e251f95ca5f8c.jpg",
    "pic_s210": "http:\/\/business.cdn.qianqian.com\/qianqian\/pic\/bos_client_58c1700bf56062108d8d622a95708032.jpg",
    "web_url": "http:\/\/music.baidu.com\/top\/dayhot"
    },
    "error_code": 22000
});

獲取榜單播放地址:
http://music.baidu.com/data/music/fmlink?r...

cb_download({
    "errorCode": 22000,
    "data": {
    "xcode": "6b3f423c71d7cd622a7250ec29f7e010",
    "songList": [
                            {
                            "queryId": "242078437",
                            "songId": 242078437,
                            "songName": "\u6f14\u5458",
                            "artistId": "2517",
                            "artistName": "\u859b\u4e4b\u8c26",
                            "albumId": 241838068,
                            "albumName": "\u7ec5\u58eb",
                            "songPicSmall": "http:\/\/musicdata.baidu.com\/data2\/pic\/cf635d76f825044a19656e990dda77d5\/241838026\/241838026.jpg",
                            "songPicBig": "http:\/\/musicdata.baidu.com\/data2\/pic\/8ed6c0b266f41eacdf69c9018c52ec1e\/241838023\/241838023.jpg",
                            "songPicRadio": "http:\/\/musicdata.baidu.com\/data2\/pic\/ac965fb4d028ee0557512c8e93f99e6c\/241838020\/241838020.jpg",
                            "lrcLink": "http:\/\/musicdata.baidu.com\/data2\/lrc\/ac66a881bd5cb97ad351936606c37495\/266097259\/266097259.lrc",
                            "version": "",
                            "copyType": 0,
                            "time": 261,
                            "linkCode": 22000,
                            "songLink": "http:\/\/yinyueshiting.baidu.com\/data2\/music\/242078559\/242078437133200128.mp3?xcode=6b3f423c71d7cd6221ec55f2ef944ac8",
                            "showLink": "http:\/\/yinyueshiting.baidu.com\/data2\/music\/242078559\/242078437133200128.mp3?xcode=6b3f423c71d7cd6221ec55f2ef944ac8",
                            "format": "mp3",
                            "rate": 128,
                            "size": 4181731,
                            "relateStatus": "0",
                            "resourceType": "0",
                            "source": "web"
                            }
                    ]
        }
})

一. 關鍵詞建議:

GET:

http://tingapi.ting.baidu.com/v1/restserver/ting?from=android&version=5.6.5.0&method=baidu.ting.search.catalogSug&format=json&query=%E4%B8%83%E9%87%8C%E9%A6%99

引數:

version   5.6.5.0    //版本
query   七里香//關鍵字
method  baidu.ting.search.catalogSug//method
fromandroid    //平臺
formatjson   //format格式

返回:

{
  "song": [
            {
              "bitrate_fee": "{\"0\":\"0|0\",\"1\":\"0|0\"}",
              "yyr_artist": "0",
              "songname": "七里香",
              "artistname": "周杰倫",
              "control": "0000000000",
              "songid": "15702101",
              "has_mv": "1",
              "encrypted_songid": "0806ef98550855dddac0"
            },
            {
              "bitrate_fee": "{\"0\":\"0|0\",\"1\":\"0|0\"}",
              "yyr_artist": "0",
              "songname": "七里香(live版)",
              "artistname": "周杰倫",
              "control": "0000000000",
              "songid": "18638327",
              "has_mv": "0",
              "encrypted_songid": "920711c65f70855e5be03"
            },
            {
              "bitrate_fee": "{\"0\":\"0|0\",\"1\":\"0|0\"}",
              "yyr_artist": "0",
              "songname": "七里香",
              "artistname": "周玥178",
              "control": "0000000000",
              "songid": "121794230",
              "has_mv": "0",
              "encrypted_songid": ""
            },
            {
              "bitrate_fee": "{\"0\":\"0|0\",\"1\":\"0|0\"}",
              "yyr_artist": "0",
              "songname": "七里香",
              "artistname": "劉芳",
              "control": "0000000000",
              "songid": "2077664",
              "has_mv": "0",
              "encrypted_songid": "50061fb3e00854ce60db"
            },
            {
              "bitrate_fee": "{\"0\":\"0|0\",\"1\":\"0|0\"}",
              "yyr_artist": "0",
              "songname": "七里香",
              "artistname": "網路歌手",
              "control": "0000000000",
              "songid": "28216714",
              "has_mv": "0",
              "encrypted_songid": "31071ae8d8a0854cc129e"
            },
            {
              "bitrate_fee": "{\"0\":\"0|0\",\"1\":\"0|0\"}",
              "yyr_artist": "0",
              "songname": "七里香(Live)",
              "artistname": "周杰倫",
              "control": "0000000000",
              "songid": "51981196",
              "has_mv": "0",
              "encrypted_songid": "58073192b8c0855ddd8da"
            },
            {
              "bitrate_fee": "{\"0\":\"0|0\",\"1\":\"0|0\"}",
              "yyr_artist": "0",
              "songname": "七里香",
              "artistname": "汪東城",
              "control": "0000000000",
              "songid": "84961907",
              "has_mv": "0",
              "encrypted_songid": "08075106a730854cdd805"
            },
            {
              "bitrate_fee": "{\"0\":\"0|0\",\"1\":\"0|0\"}",
              "yyr_artist": "0",
              "songname": "七里香",
              "artistname": "施艾敏",
              "control": "0000000000",
              "songid": "17565909",
              "has_mv": "0",
              "encrypted_songid": "420710c08d508559df21f"
            },
            {
              "bitrate_fee": "{\"0\":\"0|0\",\"1\":\"0|0\"}",
              "yyr_artist": "0",
              "songname": "七里香",
              "artistname": "蘇仨",
              "control": "0000000000",
              "songid": "84957626",
              "has_mv": "0",
              "encrypted_songid": "830751059ba08559df358"
            },
            {
              "bitrate_fee": "{\"0\":\"0|0\",\"1\":\"0|0\"}",
              "yyr_artist": "0",
              "songname": "七里香",
              "artistname": "陳淑樺",
              "control": "0000000000",
              "songid": "208828",
              "has_mv": "0",
              "encrypted_songid": "370532fbc0855e3ed63"
            }
              ],
              "order": "song,album",
              "error_code": 22000,
              "album": [
                {
              "albumname": "七里香",
              "artistpic": "http:\/\/musicdata.baidu.com\/data2\/pic\/115430839\/115430839.jpg",
              "albumid": "67909",
              "artistname": "周杰倫"
            },
            {
              "albumname": "七里香(臺灣正式版)",
              "artistpic": "http:\/\/a.hiphotos.baidu.com\/ting\/pic\/item\/3b292df5e0fe9925ff46084536a85edf8db17158.jpg",
              "albumid": "183906",
              "artistname": "周杰倫 "
            }
         ]
}

二. 關鍵字搜尋(包括歌曲,專輯,歌手,伴奏)

GET:

http://tingapi.ting.baidu.com/v1/restserver/ting?from=android&version=5.6.5.0&method=baidu.ting.search.merge&format=json&query=%E4%B8%83%E9%87%8C%E9%A6%99&page_no=1&page_size=50&type=-1&data_source=0&use_cluster=1

引數:(下面應該很容易懂,就不具體解釋了)

version     5.6.5.0
method   baidu.ting.search.merge
format   json
query    七里香
page_no  1
page_size 50
type        -1
data_source  0
use_cluster  1

返回值:

{
    "error_code": 22000,
    "result": {
        "query": "七里香",
        "syn_words": "",
        "rqt_type": 1,
        "song_info": {
            "total": 69,
            "song_list": [
                {
                    "content": "",
                    "copy_type": "1",
                    "toneid": "0",
                    "info": "",
                    "all_rate": "320,128,flac,256,192,64,24",
                    "resource_type": 2,
                    "relate_status": 0,
                    "has_mv_mobile": 1,
                    "song_id": "18401298",
                    "title": "七里香",
                    "ting_uid": "7994",
                    "author": "周杰倫",
                    "album_id": "18394691",
                    "album_title": "第五屆百事音樂風雲榜",
                    "is_first_publish": 0,
                    "havehigh": 2,
                    "charge": 0,
                    "has_mv": 0,
                    "learn": 0,
                    "song_source": "web",
                    "piao_id": "0",
                    "korean_bb_song": "0",
                    "resource_type_ext": "0",
                    "artist_id": "29",
                    "all_artist_id": "29",
                    "lrclink": "http://musicdata.baidu.com/data2/lrc/65094964/%E4%B8%83%E9%87%8C%E9%A6%99.lrc",
                    "data_source": 0,
                    "cluster_id": 93119037
                },
                {
                    "content": "",
                    "copy_type": "1",
                    "toneid": "600902000006889283",
                    "info": "",
                    "all_rate": "128,64,256,192,320,flac,24",
                    "resource_type": 2,
                    "relate_status": 0,
                    "has_mv_mobile": 1,
                    "song_id": "290466",
                    "title": "止戰之殤.",
                    "ting_uid": "7994",
                    "author": "周杰倫",
                    "album_id": "67909",
                    "album_title": "",
                    "is_first_publish": 0,
                    "havehigh": 2,
                    "charge": 0,
                    "has_mv": 1,
                    "learn": 1,
                    "song_source": "web",
                    "piao_id": "0",
                    "korean_bb_song": "0",
                    "resource_type_ext": "0",
                    "artist_id": "29",
                    "all_artist_id": "29",
                    "lrclink": "http://musicdata.baidu.com/data2/lrc/13881596/%E6%AD%A2%E6%88%98%E4%B9%8B%E6%AE%87..lrc",
                    "data_source": 0,
                    "cluster_id": 93304629
                },
              ......
            ]
        },
        "album_info": {
            "total": 2,
            "album_list": [
                {
                    "album_id": "67909",
                    "author": "周杰倫",
                    "hot": 22412,
                    "title": "<em>七里香</em>",
                    "artist_id": "29",
                    "all_artist_id": "29",
                    "company": "傑威爾JVR音樂有限公司",
                    "publishtime": "2004-08-03",
                    "album_desc": "周杰倫的新專輯在8月3日正式發行,這次引用了詩人席幕蓉名詩《<em>七里香</em>》作為新專輯名稱,周杰倫以往每一次的專輯名稱都給了歌迷許多想象空間,也給了大家許多驚歎號。這次也許並不令人驚喜。但是周杰倫自有說法:“...",
                    "pic_small": "http://musicdata.baidu.com/data2/pic/115430825/115430825.jpg"
                },
                {
                    "album_id": "183906",
                    "author": "周杰倫 ",
                    "hot": 10799,
                    "title": "<em>七里香</em>(臺灣正式版)",
                    "artist_id": "29",
                    "all_artist_id": "29",
                    "company": "傑威爾JVR音樂有限公司",
                    "publishtime": "2004-08-03",
                    "album_desc": "周杰倫的新專輯在8月3日正式發行,這次引用了詩人席幕蓉名詩《<em>七里香</em>》作為新專輯名稱,周杰倫以往每一次的專輯名稱都給了歌迷許多想象空間,也給了大家許多驚歎號。這次也許並不令人驚喜。但是周杰倫自有說法:“...",
                    "pic_small": "http://c.hiphotos.baidu.com/ting/pic/item/b8389b504fc2d562b542b1f8e51190ef76c66c58.jpg"
                }
            ]
        }
    }
}

三. 獲取專輯詳情:

GET

http://tingapi.ting.baidu.com/v1/restserver/ting?from=android&version=5.6.5.0&method=baidu.ting.album.getAlbumInfo&format=json&album_id=67909

引數:

from  android
version   5.6.5.0
method    baidu.ting.album.getAlbumInfo
format    json
album_id  67909

返回:

{
"albumInfo": {
    "album_id": "67909",
    "author": "周杰倫",
    "title": "七里香",
    "publishcompany": "傑威爾JVR音樂有限公司",
    "prodcompany": "",
    "country": "港臺",
    "language": "國語",
    "songs_total": "9",
    "info": "周杰倫的新專輯在8月3日正式發行,這次引用了詩人席幕蓉名詩《七里香》作為新專輯名稱,周杰倫以往每一次的專輯名稱都給了歌迷許多想象空間,也給了大家許多驚歎號。這次也許並不令人驚喜。但是周杰倫自有說法:“之所以要把新專輯定名為《七里香》,是因為對這一次專輯的音樂充滿自信,希望大家能把注意力焦點放在音樂上,將話題迴歸到音樂上。 這張《七里香》仍是周杰倫與最佳拍檔方文山合作的作品。在炎熱的夏天聽《七里香》,有一種如沐清風的涼爽",
    "styles": "流行",
    "style_id": "3",
    "publishtime": "2004-08-03",
    "artist_ting_uid": "7994",
    "all_artist_ting_uid": null,
    "gender": "0",
    "area": "1",
    "pic_small": "http://musicdata.baidu.com/data2/pic/115430825/115430825.jpg",
    "pic_big": "http://musicdata.baidu.com/data2/pic/115430815/115430815.jpg",
    "hot": "",
    "favorites_num": null,
    "recommend_num": null,
    "artist_id": "29",
    "all_artist_id": "29",
    "pic_radio": "http://musicdata.baidu.com/data2/pic/115430799/115430799.jpg",
    "pic_s500": "http://musicdata.baidu.com/data2/pic/115430794/115430794.jpg",
    "pic_s1000": "http://musicdata.baidu.com/data2/pic/115430787/115430787.jpg"
},
"songlist": [
    {
        "artist_id": "29",
        "all_artist_id": "29",
        "all_artist_ting_uid": "7994",
        "language": "國語",
        "publishtime": "2004-08-03",
        "album_no": "0",
        "versions": "",
        "pic_big": "http://musicdata.baidu.com/data2/pic/115430815/115430815.jpg",
        "pic_small": "http://musicdata.baidu.com/data2/pic/115430825/115430825.jpg",
        "hot": "1020",
        "file_duration": "261",
        "del_status": "0",
        "resource_type": "2",
        "copy_type": "1",
        "has_mv_mobile": 0,
        "all_rate": "320,128,256,64,flac,24,192",
        "toneid": "600902000006889316",
        "country": "其他",
        "area": "4",
        "lrclink": "http://musicdata.baidu.com/data2/lrc/34239973/%E5%80%9F%E5%8F%A3..lrc",
        "song_id": "23744596",
        "title": "藉口.",
        "ting_uid": "7994",
        "author": "周杰倫",
        "album_id": "67909",
        "album_title": "",
        "is_first_publish": 0,
        "havehigh": 2,
        "charge": 0,
        "has_mv": 1,
        "learn": 1,
        "song_source": "web",
        "piao_id": "0",
        "korean_bb_song": "0",
        "resource_type_ext": "0"
    },
    {
        "artist_id": "29",
        "all_artist_id": "29",
        "all_artist_ting_uid": "7994",
        "language": "國語",
        "publishtime": "2004-08-03",
        "album_no": "1",
        "versions": "",
        "pic_big": "http://musicdata.baidu.com/data2/pic/115430815/115430815.jpg",
        "pic_small": "http://musicdata.baidu.com/data2/pic/115430825/115430825.jpg",
        "hot": "3005",
        "file_duration": "246",
        "del_status": "0",
        "resource_type": "2",
        "copy_type": "1",
        "has_mv_mobile": 1,
        "all_rate": "64,320,128,flac,256,192,24",
        "toneid": "600902000006889292",
        "country": "其他",
        "area": "4",
        "lrclink": "http://musicdata.baidu.com/data2/lrc/13859215/%E6%88%91%E7%9A%84%E5%9C%B0%E7%9B%98-.lrc",
        "song_id": "271627",
        "title": "我的地盤-",
        "ting_uid": "7994",
        "author": "周杰倫",
        "album_id": "67909",
        "album_title": "",
        "is_first_publish": 0,
        "havehigh": 2,
        "charge": 0,
        "has_mv": 1,
        "learn": 1,
        "song_source": "web",
        "piao_id": "0",
        "korean_bb_song": "0",
        "resource_type_ext": "0"
    },
    ......
]

}

下面的只發簡要說明:
1). 獲取歌曲列表:

http://tingapi.ting.baidu.com/v1/restserver/ting?from=android&version=5.6.5.0&method=baidu.ting.artist.getSongList&format=json&order=2&tinguid=7994&artistid=7994&offset=0&limits=50

2). 獲取專輯列表:

http://tingapi.ting.baidu.com/v1/restserver/ting?from=android&version=5.6.5.0&method=baidu.ting.artist.getAlbumList&format=json&order=1&tinguid=7994&offset=0&limits=30

3). 獲取歌手資訊:

http://tingapi.ting.baidu.com/v1/restserver/ting?from=android&version=5.6.5.0&method=baidu.ting.artist.getinfo&format=json&tinguid=7994&artistid=7994

4). 獲取歌詞以及圖片:

http://tingapi.ting.baidu.com/v1/restserver/ting?from=android&version=5.6.5.0&method=baidu.ting.search.lrcpic&format=json&query=Apollo%27s%2BTriumph%2B%28Paul%2BDinletir%2BRemix%29$$Audio%2BMachine&ts=1444316027469&e=6Wwvzqnijq08Nrv0qI%2BN3Thp9GuKdV82ZxAS3UrvifMc%2FoVWLyZ8dSolFUF5r4W3SB2tm4z5TWT95sihhOG7qeqvjhThJWnh6h745kRGSTI%3D&type=2

1)搜尋建議

http://tingapi.ting.baidu.com/v1/restserver/ting?from=qianqian&version=2.1.0&method=baidu.ting.search.catalogSug&format=json&query=%E5%B0%8F%E8%8B%B9%E6%9E%9C

搜尋建議:只有歌名

http://tingapi.ting.baidu.com/v1/restserver/ting?method=baidu.ting.search.suggestion&query=%E5%B0%8F%E8%8B%B9%E6%9E%9C&format=json&from=ios&version=2.1.1

2)搜尋結果

http://tingapi.ting.baidu.com/v1/restserver/ting?from=qianqian&version=2.1.0&method=baidu.ting.search.common&format=json&query=%E5%B0%8F%E8%8B%B9%E6%9E%9C&page_no=1&page_size=30

3)

http://tingapi.ting.baidu.com/v1/restserver/ting?from=qianqian&version=2.1.0&method=baidu.ting.artist.getList&format=jsonℴ=1&offset=0&limit=5

4)新歌榜

http://tingapi.ting.baidu.com/v1/restserver/ting?from=qianqian&version=2.1.0&method=baidu.ting.billboard.billList&format=json&type=1&offset=0&size=50

5)熱歌榜

http://tingapi.ting.baidu.com/v1/restserver/ting?from=qianqian&version=2.1.0&method=baidu.ting.billboard.billList&format=json&type=2&offset=0&size=50  注意這個和上邊的區別,type=1

6)Billboard

http://tingapi.ting.baidu.com/v1/restserver/ting?from=qianqian&version=2.1.0&method=baidu.ting.billboard.billList&format=json&type=8&offset=0&size=507)Hito中文榜

7)Hito中文榜

http://tingapi.ting.baidu.com/v1/restserver/ting?from=qianqian&version=2.1.0&method=baidu.ting.billboard.billList&format=json&type=18&offset=0&size=50

8)KTV熱歌榜

http://tingapi.ting.baidu.com/v1/restserver/ting?from=qianqian&version=2.1.0&method=baidu.ting.billboard.billList&format=json&type=6&offset=0&size=50

9)電臺列表

http://tingapi.ting.baidu.com/v1/restserver/ting?from=qianqian&version=2.1.0&method=baidu.ting.radio.getCategoryList&format=json

10)獲取某個電臺下的歌曲列表
http://tingapi.ting.baidu.com/v1/restserve...
11)獲取songid的歌曲資訊

http://tingapi.ting.baidu.com/v1/restserver/ting?from=qianqian&version=2.1.0&method=baidu.ting.song.getInfos&format=json&songid=8059247&ts=1408284347323&e=JoN56kTXnnbEpd9MVczkYJCSx%2FE1mkLx%2BPMIkTcOEu4%3D&nw=2&ucf=1&res=1 

12)獲取登陸使用者的喜愛歌曲列表,其中bduss引數用來標示唯一的使用者

http://tingapi.ting.baidu.com/v1/restserver/ting?from=qianqian&version=2.1.0&method=baidu.ting.favorite.getFavoriteSong&format=json&pn=0&rn=50&bduss=UlXZ1dWbm9icDBrMm13aFcwZ282ejlTM1dyS1NEd2JPWXpQcDgyT0w0Vn5SUmhVQVFBQUFBJCQAAAAAAAAAAAEAAAB0L~cOeHl3MDQzNzM1AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAH-48FN~uPBTd

13)歌手列表

http://tingapi.ting.baidu.com/v1/restserver/ting?from=qianqian&version=2.1.0&method=baidu.ting.artist.get72HotArtist&format=jsonℴ=1&offset=0&limit=50

14)歌手簡介,tinguid為歌手id

http://tingapi.ting.baidu.com/v1/restserver/ting?from=qianqian&version=2.1.0&method=baidu.ting.artist.getinfo&format=json&tinguid=7994

15)歌手歌曲列表,tinguid為歌手id

http://tingapi.ting.baidu.com/v1/restserver/ting?from=qianqian&version=2.1.0&method=baidu.ting.artist.getSongList&format=jsonℴ=2&tinguid=7994&offset=0&limits=50

16)新碟上架

http://tingapi.ting.baidu.com/v1/restserver/ting?from=qianqian&version=2.1.0&method=baidu.ting.plaza.getRecommendAlbum&format=json&offset=0&limit=50

17)專輯資訊

http://tingapi.ting.baidu.com/v1/restserver/ting?from=qianqian&version=2.1.0&method=baidu.ting.album.getAlbumInfo&format=json&album_id=122314357

18)新歌速遞

http://tingapi.ting.baidu.com/v1/restserver/ting?from=qianqian&version=2.1.0&method=baidu.ting.plaza.getNewSongs&format=json&limit=50

蝦米音樂 / 網易雲音樂 API 介面

雲豆有限,請勿將該介面用於批量抓取。
蝦米和網易雲音樂到目前為止還沒有開放 API ,網上也有一些獲取的方法。這裡提供一個簡單的 API 介面,方便大家使用。
音樂版權歸原網站所有。該 API 介面僅供個人學習研究使用,請勿用作各種商業用途。

提供了歌詞/單曲/歌手/專輯/精選集(網易的歌單) 5 種介面,以下做簡要介紹。

API 地址

根地址為 http://api.lostg.com

蝦米歌詞 /music/xiami/lyrics/{id}
蝦米單曲 /music/xiami/songs/{id}
蝦米專輯 /music/xiami/albums/{id}
蝦米歌手 /music/xiami/artists/{id}
蝦米精選集 /music/xiami/collections/{id}

網易歌詞 /music/163/lyrics/{id}
網易單曲 /music/163/songs/{id}
網易專輯 /music/163/albums/{id}
網易歌手 /music/163/artists/{id}
網易歌單 /music/163/collections/{id}

省略網站名稱,預設呼叫蝦米音樂
例如 蝦米歌詞 /music/lyrics/{id}

省略介面類別,預設呼叫單曲音樂
例如 蝦米單曲 /music/xiamis/{id}

全部省略,預設呼叫蝦米單曲音樂
即 蝦米單曲 /musics/{id}

在獲取歌手,歌單,專輯時,由於歌曲數量可能出現過多的情況,返回值會比較大,因此建議通過以下方式僅獲取歌曲 ID,然後通過 ID 再獲取具體的歌曲資訊。

蝦米專輯歌曲 ID /music/xiami/albums/ids/{id}
蝦米歌手歌曲 ID /music/xiami/artists/ids/{id}
蝦米精選集歌曲 ID /music/xiami/collections/ids/{id}

網易專輯歌曲 ID /music/163/albums/ids/{id}
網易歌手歌曲 ID /music/163/artists/ids/{id}
網易歌單歌曲 ID /music/163/collections/ids/{id}

引數

id: 必選引數,值為單曲/專輯/歌手/精選集的 ID,歌詞介面中的引數 id 為單曲 ID
lyric: 可選引數,值可為任意值,若包含該引數,則返回值中將包含歌詞資訊
建議:當歌手/專輯/精選集中包含的歌曲數目較多時,請關閉歌詞資訊的獲取,改用歌詞介面獲取歌詞,可節約獲取時間。

返回值

返回 json 格式資料,包含以下幾個欄位:

    id: 歌曲 ID
    title: 歌曲名
    singer: 歌手
    album: 專輯名
    album_pic: 專輯圖片(一般尺寸)
    album_pic_m: 專輯圖片(小尺寸)
    album_pic_l: 專輯圖片(原始尺寸)
    lyric: 歌詞
    location: 歌曲連結

網易雲音樂的專輯圖片僅有一種大小,三個欄位的值均相同。
歌詞介面返回值中僅包含歌詞資訊。

使用方式

建議使用 AJAX 跨域請求

例如獲取蝦米音樂《Mockingbird》的資訊

$.ajax({
    type: "get",
    dataType: "jsonp",
    jsonp: "callback",
    url: "https://api.lostg.com/music/2088114", //預設介面為蝦米單曲
    data: {
        lyric: 1
    },
    async: !1,
    success: function(b) {
                console.log(b)
            }
    });

演示:https://api.lostg.com/music/2088114?callba...

網易雲音樂常用API淺析 | Moonlib

PC客戶端抓包而來
0.說明

關於頭部資訊

12Cookie: os=pc; deviceId=B55AC773505E5606F9D355A1A15553CE78B89FC7D8CB8A157B84; osver=Microsoft-Windows-8-Professional-build-9200-64bit; appver=1.5.0.75771; usertrack=ezq0alR0yqJMJC0dr9tEAg==; MUSIC_A=088a57b553bd8cef58487f9d01aeUser-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.138 Safari/537.36\r\n

上面是抓到的資訊,其中必要的只有cookie中的appver。而且如果要呼叫api,必須加上Referer,只要是music.163.com的就可以

12Cookie: appver=1.5.0.75771;Referer: http://music.163.com/

以上兩條即可

返回的格式均為json

1.搜尋

抓取到的資訊如下

123456789101112131415Full request URI:http://music.163.com/api/search/pcKey: hlpretagValue: Key: hlposttagValue: Key: sValue: \345\226\234\346\254\242\344\275\240Key: offsetValue: 0Key: totalValue: trueKey: limitValue: 100Key: typeValue: 1

URL:

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

必要引數:

s:搜尋的內容

offset:偏移量(分頁用)

limit:獲取的數量

type:搜尋的型別

歌曲 1

專輯 10

歌手 100

歌單 1000

使用者 1002

mv 1004

歌詞 1006

主播電臺 1009

2.歌曲資訊

1Full request URI: http://music.163.com/api/song/detail/?id=28377211&ids=[28377211]

URL:

GET http://music.163.com/api/song/detail/

必要引數:

id:歌曲ID

ids:不知道幹什麼用的,用[]括起來的歌曲ID

3.歌手專輯

1Full request URI: http://music.163.com/api/artist/albums/166...

URL:

GET http://music.163.com/api/artist/albums/歌手ID

必要引數:

limit:獲取的數量(不知道為什麼這個必須加上)

4.專輯資訊

1Full request URI: http://music.163.com/api/album/2457012?ext...

URL:

GET http://music.163.com/api/album/專輯ID

5.歌單

1Full request URI: http://music.163.com/api/playlist/detail?i...

URL:

GET http://music.163.com/api/playlist/detail

必要引數:

id:歌單ID

6.歌詞

1Full request URI: http://music.163.com/api/song/lyric?os=pc&...

URL:

GET http://music.163.com/api/song/lyric

必要引數:

id:歌曲ID

lv:值為-1,我猜測應該是判斷是否搜尋lyric格式

kv:值為-1,這個值貌似並不影響結果,意義不明

tv:值為-1,是否搜尋tlyric格式

7.MV

1Full request URI: http://music.163.com/api/mv/detail?id=3191...

URL:

GET http://music.163.com/api/mv/detail

必要引數:

id:mvid

type:值為mp4,視訊格式,不清楚還有沒有別的格式

轉載:https://blog.csdn.net/alpgao/article/detai...

本作品採用《CC 協議》,轉載必須註明作者和本文連結

相關文章