Groove icon indicating copy to clipboard operation
Groove copied to clipboard

关于kuwo_music_crawler.py方法getSongUrl()的URL变量参数格式化错误

Open JayZorn-LJZ opened this issue 8 months ago • 1 comments

Bug https://github.com/zhiyiYo/Groove/blob/master/app/common/crawler/kuwo_music_crawler.py#L76方法getSongUrl()url变量参数格式化错误

测试 测试步骤:操作url变量,为url变量添加参数

  1. 根据br字典中的键SongQuality.HIGH'192k'传递到变量url中的br

  2. 将歌曲324244(青花瓷)作为rid传递给url

  3. 将添加参数格式化后的url带入ApiFox中测试

  4. 请求成功,但返回json不在预期内:

    错误:"data"键中的"bitrate"值应为192

    {
        "code": 200,
        "data": {
            "bitrate": 128,
            "duration": 237,
            "format": "mp3",
            "p2p_audiosourceid": "59776931n143633458986373mp3",
            "rid": 324244,
            "sig": "14856233351564543751",
            "source": "jiakong",
            "type": 0,
            "url": "http://sr.sycdn.kuwo.cn/f5671f2603a2e3676cf91566c3f7fab9/68147080/resource/n1/43/63/3458986373.mp3?bitrate$128&format$mp3&source$jiakong&type$convert_url_with_sign&user$",
            "user": ""
        },
        "locationid": "1",
        "msg": "ok"
    }
    

预期

bitrate应为192

环境

  1. 请求header为默认
  2. 我的url变量:https://mobi.kuwo.cn/mobi.s?f=web&source=jiakong&type=convert_url_with_sign&rid=324244&br=192kmp3

我的解决方法

  1. 请求 https://www.kuwo.cn/search/searchMusicBykeyWord?vipver=1&client=kt&ft=music&cluster=0&strategy=2012&encoding=utf8&rformat=json&mobi=1&issubtitle=1&show_copyright_off=1&pn=0&rn=20&all=%E9%9D%92%E8%8A%B1%E7%93%B7
  2. 取返回值键"abslist"的第一位元素作为例子
  3. 值为下述代码块(已折叠)。注意"MINFO"键,其中的信息为格式信息,组合后才能作为br参数传递 组合方式:bitrate+"k"+format 例如:2000kfla 注意:一定要严格使用"MINFO"键(而不是N_MINFO)的值里支持的bitrate和format。没有通用的br参数,必须动态修改
查看元素值:
{
"AARTIST": "Jay Chou",
"ALBUM": "我很忙",
"ALBUMID": "12449",
"ALIAS": "",
"ARTIST": "周杰伦",
"ARTISTID": "336",
"CanSetRing": "0",
"CanSetRingback": "1",
"DC_TARGETID": "324244",
"DC_TARGETTYPE": "music",
"DURATION": "237",
"FARTIST": "周杰伦",
"FORMAT": "wma",
"FSONGNAME": "",
"KMARK": "3",
"MINFO": "level:ff,bitrate:2000,format:flac,size:24.97Mb;level:p,bitrate:320,format:mp3,size:9.05Mb;level:s,bitrate:48,format:aac,size:1.35Mb;level:p,bitrate:192,format:ogg,size:5.13Mb;level:h,bitrate:100,format:ogg,size:2.55Mb;level:h,bitrate:128,format:mp3,size:3.62Mb",
"MUSICRID": "MUSIC_324244",
"MVFLAG": "1",
"MVPIC": "324/21/57/817467462.jpg",
"MVQUALITY": "MP4;MP4L",
"NAME": "青花瓷",
"NEW": "0",
"N_MINFO": "level:ff,bitrate:2000,format:flac,size:24.97Mb;level:p,bitrate:320,format:mp3,size:9.05Mb;level:h,bitrate:128,format:mp3,size:3.62Mb;level:s,bitrate:48,format:aac,size:1.35Mb;level:p,bitrate:192,format:ogg,size:5.13Mb;level:h,bitrate:100,format:ogg,size:2.55Mb;level:zp,bitrate:20000,format:zp,size:zpMb",
"ONLINE": "1",
"PAY": "16711935",
"PROVIDER": "",
"SONGNAME": "青花瓷",
"SUBLIST": [],
"SUBTITLE": "",
"TAG": "http://gottt.com/mp3/ge/liu_xing/2057662146.wma",
"ad_subtype": "",
"ad_type": "",
"allartistid": "336",
"audiobookpayinfo": {
 "download": "0",
 "play": "0"
},
"barrage": "0",
"cache_status": "1",
"content_type": "0",
"fpay": "1",
"hts_MVPIC": "https://img4.kuwo.cn/wmvpic/324/21/57/817467462.jpg",
"info": "xxxx",
"iot_info": "A_10,B_10,C_10,D_10,G_10,H_10",
"isRedSong": 0,
"isdownload": "0",
"isshowtype": "0",
"isstar": "0",
"mvpayinfo": {
 "download": "0",
 "play": "0",
 "vid": "10307364"
},
"nationid": "0",
"opay": "0",
"originalsongtype": "1",
"overseas_copyright": "7ffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"overseas_pay": "16711935",
"payInfo": {
 "cannotDownload": "0",
 "cannotOnlinePlay": "0",
 "download": "1111",
 "feeType": {
   "album": "0",
   "bookvip": "0",
   "song": "1",
   "vip": "1"
 },
 "limitfree": "0",
 "listen_fragment": "1",
 "local_encrypt": "1",
 "ndown": "111111111111",
 "nplay": "111111111111",
 "overseas_ndown": "11111",
 "overseas_nplay": "11111",
 "paytagindex": {
   "AR501": 8,
   "DB": 7,
   "F": 3,
   "H": 1,
   "HR": 4,
   "L": 0,
   "S": 2,
   "ZP": 6,
   "ZPGA201": 9,
   "ZPGA501": 10,
   "ZPLY": 11
 },
 "play": "1111",
 "refrain_end": "117000",
 "refrain_start": "57000",
 "tips_intercept": "0"
},
"react_type": "",
"spPrivilege": "0",
"subsStrategy": "0",
"subsText": "",
"svip_preview": "0",
"terminal": "1,2,3,4,5,6,7,8,9,10,11",
"terminalOnline": "",
"tme_musician_adtype": "0",
"tpay": "1",
"web_albumpic_short": "120/7/83/4087363627.jpg",
"web_artistpic_short": "120/s4s22/47/783999746.png",
"web_timingonline": ""
}
  1. 测试。请求需求:bitrate为100,格式为ogg

    1. 根据上述第3点描述的方式进行组合:100kogg
    2. 传参,更改br参数。url为https://mobi.kuwo.cn/mobi.s?f=web&source=jiakong&type=convert_url_with_sign&rid=324244&br=100kogg
    3. 结果
    {
        "code": 200,
        "data": {
            "bitrate": 100,
            "duration": 237,
            "format": "ogg",
            "p2p_audiosourceid": "59776931n349943630477571ogg",
            "rid": 324244,
            "sig": "15592782437649547465",
            "source": "jiakong",
            "type": 0,
            "url": "http://lu.sycdn.kuwo.cn/c6c9776f6d5ab151ac8e88ebc3e58ab1/6814742e/resource/n3/49/94/3630477571.ogg?bitrate$100&format$ogg&source$jiakong&type$convert_url_with_sign&user$",
            "user": ""
        },
        "locationid": "1",
        "msg": "ok"
    }
    

总结

br的自定义格式应为:bitrate+"k"+format

JayZorn-LJZ avatar May 02 '25 07:05 JayZorn-LJZ