Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

QQ Music API Analysis 2017

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

API is available on the official website

Note: this API is mainly used to call QQ Music API directly for mobile devices. API can only be executed in QQAPP, and the launch time is still short.

Http://y.qq.com/m/api/api.html

Self-analysis of API

Description:

According to the API analyzed by https://y.qq.com/ on the official website, after testing, it can be used. The test demo is as follows: demo process

1. First, search for the song "get playback key" based on keywords to get the playback address.

Http://192.168.60.50:8081/shiro/public/music

After analysis, it is not necessary to obtain the playback key, classify it first, and obtain the playback address of the single by "get songs" on the ranking list.

Analyze the advantages and disadvantages of api by yourself

Advantages: API can be directly js cross-domain direct call, can also be java secondary encapsulation, provided in restful way, flexible and convenient

Disadvantages: some parameters of API are not clear, and the changes of API updates are unknown. According to the previous point of view, the interfaces of 2015 are basically available now.

Below are some of your own analysis of api and other resources

Get a list of hot words

Https://c.y.qq.com/splcloud/fcgi-bin/gethotkey.fcg?g_tk=5381&jsonpCallback=hotSearchKeysmod_top_search&loginUin=0&hostUin=0&format=jsonp&inCharset=utf8&outCharset=utf-8¬ice=0&platform=yqq&needNewCode=0

Get version update log

Description: version update note

Example:

Https://y.qq.com/download/download.js?loginUin=0&hostUin=0&format=json&inCharset=utf8&outCharset=utf-8¬ice=0&platform=yqq&needNewCode=0

Search for songs based on keywords

Address: https://c.y.qq.com/soso/fcgi-bin/client_search_cp

Description: return song list, album, singer and other information according to keyword search

Main parameters:

W: keyword

P: page number, starting with 1

N: the number of data items on the current page

Example:

Https://c.y.qq.com/soso/fcgi-bin/client_search_cp?ct=24&qqmusic_ver=1298&new_json=1&remoteplace=txt.yqq.center&searchid=37602803789127241&t=0&aggr=1&cr=1&catZhida=1&lossless=0&flag_qc=0&p=1&n=20&w=%E5%88%98%E5%BE%B7%E5%8D%8E&g_tk=5381&loginUin=0&hostUin=0&format=json&inCharset=utf8&outCharset=utf-8¬ice=0&platform=yqq&needNewCode=0

Search for songs based on album

Address: https://c.y.qq.com/v8/fcg-bin/fcg_v8_album_info_cp.fcg

Description: search songs according to album ID

Main parameters:

Albummid: album ID

Example:

Https://c.y.qq.com/v8/fcg-bin/fcg_v8_album_info_cp.fcg?albummid=002LiyZW27dGjC&g_tk=5381&loginUin=0&hostUin=0&format=json&inCharset=utf8&outCharset=utf-8¬ice=0&platform=yqq&needNewCode=0

Ranking classification

Https://c.y.qq.com/v8/fcg-bin/fcg_v8_toplist_opt.fcg?page=index&format=html&tpl=macv4&v8debug=1&jsonCallback=jsonCallback

Parameter description:

Page=index said this is the front page of the ranking.

The return format of format=html is html

Debug:debug=1 is in debug mode, which directly returns the cross-domain json format, and other values directly return to the html page

JsonCallback: this parameter is optional

This API cannot directly return json format, only jsonp format

The format of the returned data is jsonp. You can call this API directly with jquery to return data.

/ / JQuery JSONP Support

Varurl = "http://192.168.0.103:12075/api/test.aspx?id=1&callback=?";

JQuery.getJSON (url, function (data) {

/ / process the returned json data

Alert ("name:" + data.name+ ", Price:" + data.price)

});

Album picture

A small picture of 90x90

Https://y.gtimg.cn/music/photo_new/T002R90x90M0000032gbwN4J7f7c.jpg?max_age=2592000

Big picture of 300x300

Https://y.gtimg.cn/music/photo_new/T002R300x300M0000032gbwN4J7f7c.jpg?max_age=2592000

Resolution of album Picture File name

T002R: unknown

300x300 or 90x90: picture size

M000: unknown

0032gbwN4J7f7c: album ID

.jpg: picture suffix

Get how many songs in the top of the list

Main parameters:

Date: query date

If the ranking is counted by day, the date is counted to yesterday, and the format is "2017-09-12"

If the ranking is on a weekly basis, as of Thursday last week, the format is "2017-36", marking the 36th week of 2017.

How to get it? it mainly takes the "update_key" field value returned by the API "ranking Classification".

Song_begin: song start tag, starting with 0

Song_num: number of songs

Topid: ranking ID

Https://c.y.qq.com/v8/fcg-bin/fcg_v8_toplist_cp.fcg?tpl=3&page=detail&date=2017-09-12&topid=4&type=top&song_begin=0&song_num=30&g_tk=5381&jsonpCallback=MusicJsonCallbacktoplist&loginUin=0&hostUin=0&format=jsonp&inCharset=utf8&outCharset=utf-8¬ice=0&platform=yqq&needNewCode=0

Get key

Address: https://c.y.qq.com/base/fcgi-bin/fcg_musicexpress.fcg

Note: the KEY obtained by this API is temporarily unused. It is speculated that it may be an expired API.

Main parameters: guid: random numbers, generated according to certain rules. For more information, please see "guid Generation rules".

Example: https://c.y.qq.com/base/fcgi-bin/fcg_musicexpress.fcg?json=3&guid=8383045540&g_tk=5381&loginUin=0&hostUin=0&format=json&inCharset=utf8&outCharset=GB2312¬ice=0&platform=yqq&needNewCode=0

Get vkey

Address: https://c.y.qq.com/base/fcgi-bin/fcg_music_express_mobile3.fcg

Description: get the vkey of playing music, the key API

Main parameters:

Guid: random number

Songmid: song ID

Filename: song file name, which is generated according to certain rules. For more information, please see "song file name generation rules".

Example:

Https://c.y.qq.com/base/fcgi-bin/fcg_music_express_mobile3.fcg?g_tk=5381 & loginUin=0&hostUin=0&format=json&inCharset=utf8&outCharset=utf-8¬ice=0&platform=yqq&needNewCode=0&cid=205361747&uin=0&songmid=001Qu4I30eVFYb&filename=C400001Qu4I30eVFYb.m4a&guid=8383045540

Get the playback address of a single

Https://c.y.qq.com/v8/fcg-bin/fcg_play_single_song.fcg?songmid=004gPqc32etVgm&tpl=yqq_song_detail&format=jsonp&callback=getOneSongInfoCallback&g_tk=5381&jsonpCallback=getOneSongInfoCallback&loginUin=0&hostUin=0&format=jsonp&inCharset=utf8&outCharset=utf-8¬ice=0&platform=yqq&needNewCode=0

Main parameters:

Songmid: song id

Get the list of popular songs that contain this song

Https://c.y.qq.com/rcmusic/fcgi-bin/fcg_iphone_music_rec_songlist?jsonpCallback=musicRecSongListCallback&cid=338&ct=20&songid=5110311&uin=10000&p=0.3702123376466666&g_tk=5381&jsonpCallback=musicRecSongListCallback&loginUin=0&hostUin=0&format=jsonp&inCharset=utf8&outCharset=utf-8¬ice=0&platform=yqq&needNewCode=0

Play a song

Address: http://dl.stream.qqmusic.qq.com/ song file name

Description: it is actually a file path with vkey, which can be played in the html5 audio tag.

Main parameters:

Vkey: through the "get vkey" API, get

Guid: generate according to certain rules

Fromtag: I don't know how to get it. Take a fixed value of 66 at present and save a cookie (name qqmusic_fromtag) later.

Example:

Http://dl.stream.qqmusic.qq.com/C400003OUlho2HcRHC.m4a?vkey=49B4DE20FEE0838FF6DBD07FE9925236361D5660C24BADBA91618A7D69A99F4F3754DE863CD187FD360A659795B5817D46B9D5B6C60E0782&guid=8383045540&uin=0&fromtag=66

No return value. Open the link and play directly.

Get an introduction to the album

Https://c.y.qq.com/v8/fcg-bin/fcg_v8_album_info_cp.fcg?albummid=0032gbwN4J7f7c&g_tk=5381&jsonpCallback=getAlbumInfoCallback&loginUin=0&hostUin=0&format=jsonp&inCharset=utf8&outCharset=utf-8¬ice=0&platform=yqq&needNewCode=0

Get song MV information

Https://c.y.qq.com/qzone/fcg-bin/fcg_mv_getinfo_bysongid.fcg?utf8=1&mids=0021SIVy2hJFCT&uin=10000&p=0.26223891580381453&g_tk=5381&jsonpCallback=JsonCallback&loginUin=0&hostUin=0&format=jsonp&inCharset=utf8&outCharset=utf-8¬ice=0&platform=yqq&needNewCode=0

Mids: ID (songmid) of the song

Return information:

JsonCallback ({"code": 0, "reportcode": 0, "subcode": 0, "num": 1, "mvlist": [{"songmid": "0021SIVy2hJFCT", "songid": 203785058, "mvid": 1364014, "mvvid": "t0024qgbzmj"}]})

Get the lyrics

Https://c.y.qq.com/lyric/fcgi-bin/fcg_query_lyric.fcg?nobase64=1&musicid=203785058&callback=jsonp1&g_tk=5381&jsonpCallback=jsonp1&loginUin=0&hostUin=0&format=jsonp&inCharset=utf8&outCharset=utf-8¬ice=0&platform=yqq&needNewCode=0

Main parameters:

Musicid: song ID (songid)

This API can no longer be called normally. Here you can use another API to return data in XML format.

Http://music.qq.com/miniportal/static/lyric/10/4900010.xml

4900010 is the song ID

10 is the value of the song ID0

Guid generation rules

Function getGuid () {

Var t = newDate. GetUTCMilliseconds ()

Return _ guid = Math.round (2147483647 * Math.random ()) * t% 1e10

}

Guid is set to cookie. When you get guid, you first get it from cookie. This cookie expires in 2038.

[xss_clean] = "pgv_pvid=" + guid + "; Expires=Sun, 18 Jan 2038 00:00:00 GMT;PATH=/;"

Song file name generation rules

Description: C100, c200, c300, c400 are fixed values, c400posi.m4a is the suffix of the song file name.

C100+ song ID+.m4a

C200 + song ID+.m4a

C300 + song ID+.m4a

C400 + song ID+.m4a

Other interfaces can be crawled in real time on the official website.

Other relevant materials

Play the core JS

Https://y.gtimg.cn/music/portal/js/common/pkg/player_module_b5739d0.js

New song list: http://music.qq.com/musicbox/shop/v3/data/hit/hit_newsong.js

General list: http://music.qq.com/musicbox/shop/v3/data/hit/hit_all.js

Summary

QQ online music front-end uses nodejs, all will see a lot of such code

The path in this is the relative path, and the path prefix is

Https://y.gtimg.cn/music/portal/

Easy to analyze the source code

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report